CanShowDetails is always true, except for licenses. In that case,
redirect users to the main page, instead of showing them an empty
licenses tab.
CanShowDetails and TabSettings.AlwaysShowDetails are longer needed.
Change-Id: I6a3630c38dcaa36c8f5105e410ba5ea70ec8d4c5
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/262099
Trust: Julie Qiu <julie@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
UnitContentName will only ever be "Main". Instead, hardcode in the text
to be displayed in the template.
Change-Id: Ia26bbc729191f8debb041114c1110b0c3e840dcf
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/262098
Trust: Julie Qiu <julie@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Logic for rendering the main unit page (which is not shared with other
tabs) is factored out into a fetchMainPage function and MainDetails
struct. This means that GetUnit and GetImportedBy are no longer
called unnecessarily when fetching data for non-main page tabs.
Data for MainDetails is now stored on UnitPage.Details, as is the case
with other tabs. A couple of fields are added/changed:
* LastCommitTime is renamed to CommitTime, since they mean the same thing
and the latter is less verbose.
* IsPackage is added, which is used to determine whether a documentation
section should be shown, even if the documentation is empty.
* NumImports is added, which is used to display the number of imports
for given package.
UnitPage.Unit is changed to a UnitMeta type, since other fields on Unit
are no longer needed and UnitMeta is more explicit.
Change-Id: I7d5f4de867678c60d697fe9559416f3171f2d15c
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/261721
Trust: Julie Qiu <julie@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
UnitPage.PackageDetails is renamed to UnitPage.Details, since the
details are not necessarily always for a package.
Change-Id: I151377a59a5515bcc2115489408d497cb9a86789
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/261998
Trust: Julie Qiu <julie@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Instead of computing the page type using .Unit methods, use the already
computed page type in these templates.
Change-Id: I7b724b7ca64027aa6a2defbc6d806f6afaa1e095
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/261719
Trust: Julie Qiu <julie@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
Rather than computing the page type name in the template, use the actual
display name as the value of the page type consts.
This allows us to render pageTypes directly in the templates.
Change-Id: I5de0e165fd96db92afeb066e0f237bc4159f6724
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/261718
Trust: Julie Qiu <julie@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
Removes Google fonts in favor of system fonts to
improve readability and page load performance.
Fixesgolang/go#40959
Change-Id: Ib462d609de70699cff602f751593bcbd38cfeb48
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/261501
Trust: Jamal Carvalho <jamal@golang.org>
Trust: Julie Qiu <julie@golang.org>
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Updates the styles on the "go to main page" link on
the metadata pages. Keeps header height consistent
between page navigation.
Change-Id: I1f1a5032df03d082db4b070d6ec035297c24fac5
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/261503
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
The Standard library page is no longer labeled as module, and all stdlib
packages are labeled with the "stdlib" label.
pageInfo is refactored and split into pageTitle, pageType, and
pageLabels.
Change-Id: I59cec2e05de01b6c0b191e428e8229fc95d67b2e
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/259999
Trust: Julie Qiu <julie@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
Updates styles for main page sections to fix
target link click. This makes sure the content
appears below the fixed header when target links
are clicked.
Change-Id: Icfb97f00d82aeb3b46e30cae0b379249453f6e96
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/261500
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
Show only fetches in progress on the worker home page.
Change-Id: If0d963bffa4edb80199e817a38d7e89530fedd31
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/260938
Trust: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
Fixes issue where a single item in a nav group
like Index > Examples looks cluttered.
Change-Id: Icf9103c4f6e7b57339df7187ca593f4ef604367f
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/260727
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
The empty alt text indicates to assistive technologies
that the image is decorative and can be ignored.
Change-Id: Ia48bdfe613c25bc178f2c0c1f6c6969340f9eb0d
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/260726
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
Adds the path to the copy button tooltip to
make explicit what is being copied.
Change-Id: Ie2bc1c6832f86351156699bb85b97384e702bb7a
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/260725
Reviewed-by: Julie Qiu <julie@golang.org>
Trust: Jamal Carvalho <jamal@golang.org>
CanonicalURLPath was incorrectly using requested version.
This change updates CanonicalURLPath and replaces it with
URLPath where requested version is needed.
Change-Id: Ie624c91c258d7ec87e8d3fd61c5b339612904a5b
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/260721
Reviewed-by: Julie Qiu <julie@golang.org>
Trust: Jamal Carvalho <jamal@golang.org>
Disables the jump to modal from opening when documentation
does not exist for the current page.
Change-Id: Ic67019003ae4adc9482a67a72f2f077eadb0363d
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/260720
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
This change modifies the script used to generate github styles to save
to a separate css file while converting the px values to rem. Note
thatthe generated styles is formatted properly after run with prettier.
Change-Id: I860e4512a5ff281a6d53210293cb310d5c5e074c
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/258257
Trust: Miguel Acero <acero@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
The top level sections now have anchor links in the format of
#section-<headingName>.
Change-Id: I9813e8ab226f3696ae09378ba3b560525664bfc1
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/259958
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
Trust: Julie Qiu <julie@golang.org>
The size of h4s is increased, so that functions and types are displayed
at a more readable size.
Change-Id: I48df1bcfe4d319b0a3ae78f4ab89185525d08a17
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/259624
Reviewed-by: Jamal Carvalho <jamal@golang.org>
Trust: Julie Qiu <julie@golang.org>
The directories section is refactored to display content using the new
NestedModule and Subdirectory structs, rather than the old
createDirectory.
The path prefix is now trimmed from nested modules. For example,
golang.org/x/tools/gopls is displayed as "module gopls" on the
golang.org/x/tools page, instead of "module golang.org/x/gopls".
Change-Id: I6e1a160bec42055c78d566e6ed4bc14d542bbfd3
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/259319
Trust: Julie Qiu <julie@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
Creates accordion controller for use in the left sidebar.
Collapses and expands top level sidenav sections.
Change-Id: I11122b96a10241d55e125515b5b8ccb41f27c461
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/259629
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
Moves the generated github styles into its own "readme.css" file. This
is preparing for the next CL that will generate changes for the
readme.css file.
Change-Id: Ic9f617695030129334b2eb9a47cb74a982576748
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/257697
Reviewed-by: Julie Qiu <julie@golang.org>
Trust: Miguel Acero <acero@google.com>
Hides the expand icon on the left of outline sections for functions,
types, and notes when the sections are empty. Adds anchor links to the
functions, types, and notes sections. Collapses inactive sections when
a new section is focussed. The file sidenav.js is copied into
legacy_sidenav.js.
Change-Id: I637cdc867c7d1b4aee941f12c09f061fdef070f7
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/259446
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
The play button now shows an icon to indicate that clicking that button
will take the user to an external site.
Change-Id: I92c0f13ee22f1f04ae12196d0d656f8ec088ffcb
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/259214
Trust: Julie Qiu <julie@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
The header is updated so that a single link to the license tab is shown,
instead of a separate anchor link to each license.
Change-Id: Ib6b2d948f96227805e73816c0cc1108eea1ca8a5
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/259213
Trust: Julie Qiu <julie@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
"Standard library" is also cased with a lowercase "library" throughout
the site. Previously, some parts of the site displayed "Standard
Library".
Change-Id: I41e1ff411f19ebd592991c39edaed68534cf8dc1
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/259205
Trust: Julie Qiu <julie@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
Adds JS to update the active sidebar section on page load
and adds event listeners to update the active section on
selection.
Change-Id: Ib5a8948089cf1981d8a3097183bf9f85659e49da
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/259202
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
Updates unit page count to use db.GetImportedBy for data. This will report
incorrect numbers when using proxy datasource.
Change-Id: Ie5b0004f3ef7a00436cb6cddfb030f263cdacbe8
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/259197
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
An initial version of the source files section is added to the unit
page. The content for this section should be present, but needs to be
styled in a future CL accordingly to spec.
Change-Id: I398bcd3052048567e5c3a9695427afc3a85a0731
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/259005
Trust: Julie Qiu <julie@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
Changes jump to input to button in sidebar to
account for keyboard navigation. Prevents modal
from opening on element focus.
Change-Id: I79515cae0338d0e0dcfadde70193346c47e5e434
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/258526
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
Makes right sidebar scroll with the rest of the
documentation page.
Change-Id: I9f433f4f8d8542e2db29482938e3aecfbf1c9246
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/258287
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
To understand worker behavior better, add more information
the worker home page.
- The name of the pod (hostname), so we can know which pod we're
looking at.
- More memory statistics, to understand why workers restart.
- Information about all the fetches in progess, and finished within
the last minute.
Change-Id: I38098069f5e03166971e67ad53a64c539ef8b5cf
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/258017
Trust: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
Drop all empty sections. Use airplane gopher image with a empty
message for packages without documentation.
Change-Id: I35e8d074b96b9b218799f4e4139ea3662a73eb62
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/257975
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Updates the copy in the back link on metadata pages.
Change-Id: I6e938e88f440f39261fdb3b6c240648d7988329d
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/257970
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
Adds jump to identifier element to the right sidebar.
Focusing on the element will open the jump to modal.
Change-Id: I0dc49d0d5fd93b7f1e4c85f0960cffe03fbb1df8
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/257661
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
Updates the class selector in jump.js to use a js specific class.
Classes used in js to select elements should have the js prefix.
Change-Id: I6481b29c14fa9da11ccdaa76842919283a25fe39
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/257657
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
Adds a navigation element to return to
the unit page from package data pages.
Change-Id: I704e60e37ae587365c3713b448260944c384f34b
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/257140
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
Adds package details data to unit struct and
render pages for versions, licenses, imports
and imported by tabs.
Change-Id: I38ce022bd7ea4a2df53310f3d2dd631fcca020ce
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/256879
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
Gather information about the current cgroup, which
is the implementation of a docker container.
Move all the memory functions to a separate file.
Reduce the display values to the ones that seem to be the most
meaningful.
Change-Id: Ifad13d96750356b6343a65d4945314029e092567
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/256519
Trust: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
Creates new files for unit fixed header ui
in preparation for future changes that diverge
from the existing fixed nav. Contains no code changes
outside of renamed css classes.
Change-Id: I450565deea86d88bb10c580f840d0cdd59c5c683
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/256540
Reviewed-by: Julie Qiu <julie@golang.org>
Trust: Jamal Carvalho <jamal@golang.org>
Adds css to unhide the doc index on the unit page and
an index link in the sidenav that is hidden on the
package details page.
Change-Id: Ieffe1368aaa1fc7cfcd4250359279b94d18a500b
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/256537
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
Adds the seperated sidenav and mobile nav to unit page.
Change-Id: Iae960e4ff103591d101b6300ccdf70a05d575fe5
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/256039
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
If the experiments come from a config file, they can't be dynamically
updated. So remove the update form on the worker home page.
Change-Id: I1a6dda10570aa7e08b0392af593dfcc6b44cfa91
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/256517
Trust: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
Instead of using globals, put all loadshedding state
into a struct.
Also, generalize the names so they're not zip-specific.
This CL address Rob's comments on https://golang.org/cl/c/pkgsite/+/255759/6.
Change-Id: I2200ec45bfc9b2d3dc82aa62b4eb211849d9d9ca
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/255979
Trust: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Keep track of load-shedding statistics.
Display them on the worker home page, along
with various memory statistics that help
to understand the worker's memory usage.
Change-Id: I6582ffbd2be5c0f4c6c6d1750f489a77922b0ffb
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/255977
Trust: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
Update comment that points to an incorrect path to the correct one.
Change-Id: Ie7c923cec5afe9c195b71ff8a33c542e1d2816da
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/255962
Reviewed-by: Julie Qiu <julie@golang.org>
Trust: Julie Qiu <julie@golang.org>
Trust: Miguel Acero <acero@google.com>
Run-TryBot: Miguel Acero <acero@google.com>
Adds the initial unit page port of the fixed nav and restructures
the unit page template to match design requirements.
Change-Id: I49eac0bb3fe5809a5e755b8c7ee925dafdfeb2e0
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/255598
Trust: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
Creates the html template for the directories section of the unit page.
Change-Id: Ie52a432096d0b7eec9ff6a6b06581954cce92485
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/255041
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
Creates the html template for the documentation section of the unit page.
Change-Id: I2d87a1d577b785829441f9e3621a021c442fd01a
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/255022
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
Creates the html template for the new readme. Part of a series of
changes related to the new unit page.
Change-Id: Idbddcd00837aaa399d64aff4ef897d8dd75d0136
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/254842
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
In addition to providing a frontend fetch button, link to the manual
way to add a package.
Fixesgolang/go#41347
Change-Id: Iaf767e0cff773ddb9f099067d6bc11e2d6fd25e7
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/255097
Trust: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
This reverts commit dd6f8882c0.
Reason for revert: these classes are still being used
Change-Id: I996d02b1f4c318f4eb2e1b1710e3492314196eda
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/255024
Trust: Julie Qiu <julie@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Previously, requests to pkg.go.dev/<path> were redirected to
pkg.go.dev/<path>?tab=doc.
The behavior is now the opposite: requests to pkg.go.dev/<path>?tab=doc
will redirect to pkg.go.dev/<path>. Requests to pkg.go.dev/<path>
will stay there.
Additionally, requests to pkg.go.dev/<path> will always show the
documentation tab, regardless of whether the package is redistributable.
Previously, users were shown the overview tab when a package is not
redistributable.
Fixesgolang/go#37351
Change-Id: Ic7ccbbb840cf04511d419f06eb7fb40ac57f68be
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/254745
Trust: Julie Qiu <julie@golang.org>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
This is partial implementation of the site redesign. Implements
the new header behind the "unit-page" feature.
Change-Id: I5fdd5c55bb9a9257311f9fd35bafbfab1ea7b7f0
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/253738
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Trust: Jamal Carvalho <jamal@golang.org>
This change adds the HTML and CSS changes for the subdirectories
template to include nested modules in the table with a modules badge.
This includes adding a --light-blue CSS variable to reflect the blue
background of the modules badge.
This change also deletes the _directories.tmpl helper template so that
iterating through the packages and nested modules in the HTML table is a
lot clearer.
before/after images: https://photos.app.goo.gl/2reDtNHxThVnDMiL9
Updates golang/go#38596
Change-Id: Id1dad1ba3a28881a203bf90afe1d5372ede2317c
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/254019
Reviewed-by: Julie Qiu <julie@golang.org>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
content/static/css is moved to devtools/cmd/css (pure code in motion).
Change-Id: I7b48bf017edffb1b4c3c571ed44bac7e09e37918
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/253608
Reviewed-by: Jamal Carvalho <jamal@golang.org>
This change replaces display: none; with display: flex; to enable
executable examples in in the documentation page. The HTML changes used
for this CSS change requires the executable-examples feature flag.
Updates golang/go#36865
Change-Id: I2cb62438663ecbfbccfe1f5b4b6b1e2dbe3e3916
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/253599
Reviewed-by: Julie Qiu <julie@golang.org>
Adds a handler to capture rejected promises and
report them to Google Analytics.
For golang/go#40958
Change-Id: Ic0a48d03acbe238bedb2b4eeac7dfb31a8e26d25
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/253597
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
Adds a handler to catch unhandled exceptions and report them to
Google Analytics.
Updates golang/go#40958
Change-Id: I9d9a501da4fea2e95a36809535b234a7d2537f02
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/251918
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Adds the web vitals script built from source to track web vitals metrics
with Google Tag Manager. This will give us more insight into how pkgsite
is performing in the wild and allow us to track changes in performance
before and after the redesign.
Updates golang/go#40958
Change-Id: Ieba237150b6a7056b5dee57911432678bb914b19
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/251537
Reviewed-by: Andrew Bonventre <andybons@golang.org>
VersionStats is a relatively costly query, and can cause it the worker
homepage to take a long time to load. This data is moved to the
/versions page instead to reduce latency on the main worker page.
Change-Id: I7273d8244185a2df94b101d2f48174102f2d23de
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/252357
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
With the inclusion of the latest major version function, this commit
changes current "latestversion" naming to "latestminorversion" in the
latestversion middleware to specify the difference between both
functions.
Updates golang/go#37765
Change-Id: I1c4d8edf6ac30431ef1278abaa334d96cd459258
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/251083
Reviewed-by: Julie Qiu <julie@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
This change includes auto expand functionality for examples in
playground.js which is included with the executable-examples feature
flag. This includes:
When users click on an example href that links to an example, the
example will be auto expanded as such:
before example link: https://i.imgur.com/7fSa3E9.gif
after example link: https://i.imgur.com/4dQ4UWO.gif
When a user navigates to a pkg.go.dev url with an example hash (i.e:
?tab=doc#example-AtomicLevel), the example is auto exapnded.
before hash change: https://i.imgur.com/luKw5uo.gif
after hash change: https://i.imgur.com/mzUl33F.gif
Updates golang/go#37520
Change-Id: I6cba5ea979ed516bcdb753eee92eecec7839c2f4
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/250467
Reviewed-by: Julie Qiu <julie@golang.org>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
- Fix link to task queue: the URL now includes a location ID
- Remove reference to "etl"
Change-Id: Iaa95e1821afde929e93202dc667fd54b5fd27b54
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/250097
Reviewed-by: Julie Qiu <julie@golang.org>
Add the iframe that loads Google Tag Manager when JS is disabled.
It doesn't need a nonce.
Fixesgolang/go#40321.
Change-Id: I93871833c55aa41185cf5d1c2d5a759937fe79b7
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/245557
Reviewed-by: Andrew Bonventre <andybons@golang.org>
This change places the side navigation flush left and allows the
documentation to expand to fill the rest of the page. The
documentation container has a maximum width of 60rem (960px)
and is flush left in the main container when it can no longer
expand.
Also moves tab name strings into constants and documents the
fields on the basePage struct.
Updates golang/go#40612Fixesgolang/go#40557
Change-Id: Ia1be6ffb04d6c8819371ad12f56e133e2167d2fd
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/248857
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
The address bar URL will be updated to be the canonical url of package.
Canonical url includes the module version in address bar.
Fixesgolang/go#36807
Change-Id: I4a6f9737ff7e112ebf1d093b2eebe2af311fb0c6
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/239179
Reviewed-by: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
+ Add blank alt text to decorative images (including the main image)
+ Preserve the main image ratio when sizing using CSS
+ Reduce the intrinsic size of the main image since we were displaying
a much smaller version on the page
+ Adjust CSS for smaller viewports. Specifically, reduce top margins
at smaller viewports
+ Update CSS to be mobile by default, with media queries covering
wider viewports (to be in line with the other CSS across the site)
+ Update the background color of one of the footers to ensure we have
satisfactory contrast ratio as reported by Lighthouse
+ Use smart quotes around sample searches
+ Transform the label text for example searches using CSS instead
of directly typing in all caps
Updates golang/go#40504
Change-Id: I55d2823094d9968d00c6d48e64b10af5abd965f6
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/248185
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
We’ve received feedback that a fully-collapsed side nav prevents users
from being able to see package structure at a glance. Expand all
functions and types by default.
Also updates CSS for the side nav to not show a scroll bar if the
content doesn’t overflow.
Updates golang/go#40612Fixesgolang/go#40715
Change-Id: I22049e394b8705316e1ebe1cb9691c6317c61c5b
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/248183
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
The Worker homepage is split into two pages, since there were latency
issues with rendering the homepage. The content on the homepage is split
into the following:
"/": shows the worker homepage and high-level stats
"/versions": shows information about recent versions that were processed
The CSS and JS are moved into files in content/static/css/worker.css and
content/static/js/worker.js, respectively.
Change-Id: Iad713d7b3c98bf8f8ef4e5522c1d7e2377a766a6
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/247178
Reviewed-by: Jonathan Amsterdam <jba@google.com>
This change fixes an issue where tabs on details pages were not
properly disabled. In the case where a tab should be disabled,
the href tag is omitted from the link to take it out of the tab
order and the text is properly styled (grayed out with no hover
styling).
In the case of the overflow menu, an additional attribute
data-always-disabled is set for items that should remain disabled
regardless of whether they are shown in the tab list or not.
Fixesgolang/go#40571
Change-Id: I2faeb5413493d38737c2c7fadd6f0b9a224c5e7d
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/246760
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
Add a check for HTML ids that could be valid Go identifiers or dotted
expressions. Such ids are reserved for rendered documentation, which
must use them so people can jump directly to the documentation for a
symbol by typing it as a fragment.
Change-Id: I646449906a845d17ce9d3740ad13d0e0ae514b8d
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/242498
Reviewed-by: Julie Qiu <julie@golang.org>
Now that the new homepage is launched removing the legacy homepage
code and references to the new-homepage experiment.
Change-Id: I94bd2c0cf5f1069c86343cc8972f91ded8600553
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/246440
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Since the search input is collapsed when not in focus on small
viewports, the text should not be shown.
Updates golang/go#40504
Change-Id: Ie4ea3e37a3c22ab7e9cb3198ec3c50108978547d
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/246580
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
This change updates the styled :target pseudo-element to restrict
it to details pages since a fixed header is not present on others.
Updates golang/go#40504
Change-Id: Ifc528eb2ef6a10526615f29002f27abdb698605e
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/246577
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
overflow: auto was fixing an issue relating to the overflow menu
in the fixed header on iOS, but was causing a bunch of other issues.
Notably, the scrollbar was underneath the fixed header and anchor
links did not behave as expected. Only set this on mobile Safari
(where these issues don’t present themselves; I’m sure others will
pop up but they’re at least restricted to mobile Safari).
Updates golang/go#40504Fixesgolang/go#40552Fixesgolang/go#40556
Change-Id: Ib7e108672d6897421faefa3a0b45cc6d7835bb15
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/246478
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
The searches listed on the homepage are example searches, not
necessarily the most popular. The caption is changed accordingly.
Change-Id: Ife71e2b8856b45526a5cd88c2214c0bd06dbf6af
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/246439
Reviewed-by: Jamal Carvalho <jamal@golang.org>
A section for package files containing links to the source code
files was added in CL 240007.
These will now be displayed on pkg.go.dev.
For golang/go#37863
Change-Id: I35a7e74f631aa1f8c0a9775b0d721e7646843291
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/246437
Reviewed-by: Jonathan Amsterdam <jba@google.com>
This change specifies more granular page types primarily for use
by the details pages to differentiate between the type of page
(module, package, etc.) and the name of the item being viewed.
This change also hides the type of the item in the fixed header
when it is not wide enough to show other information.
Change-Id: I1e25e75dbdbac01b5d54ea96224f3464cf9fa9f9
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/245487
Reviewed-by: Julie Qiu <julie@golang.org>
This change implements the latest designs for the site header,
adds a new fixed header to details pages, and updates to the
latest Closure Compiler Docker image tag to support an API used
by the new fixed header implementation (ResizeObserver).
The global header is no longer sticky, but on the details page
a hybrid header that shows a combination of the header content
and details tabs is displayed when the inline tab list goes out
of view.
Both the inline and fixed tab lists are responsive in that the
elements are pushed to an overflow container when they can no
longer fit on screen. A native <select> tag is used for this to
avoid implementing a popup menu (perhaps that can be done in a
future change).
The mechanism used to copy the current path to the clipboard has
also been updated to avoid hacks that didn’t play well with
screen readers. This method does not work on iOS, but a message
is displayed to the user in that case.
Fixesgolang/go#37110
Change-Id: I2b8b73d7e85c122992b106e9b89d7e207be9f099
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/245400
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
Adds the ability to update existing experiment rollouts to the worker
page giving team members without db access the ability to rollback
experiments when performing on-call duty.
Change-Id: If35304cb4add31a44d5f54bd634dafa7a838e616
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/245900
Reviewed-by: Julie Qiu <julie@golang.org>
The text in fetch.tmpl is updated to provide clearer instructions.
Corresponding CSS is also adjusted for these text changes.
For golang/go#37002
Change-Id: Iae8b641eb2471172eb4465493fe83a4005bce6fc
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/245880
Run-TryBot: Julie Qiu <julie@golang.org>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
This reverts commit 369bd985a3.
Reason for revert: I forgot I marked CL 245646 as WIP because
I had to fix a test.
Change-Id: Ic2f7edf97733630f39d8a730829abcd2a306a0e6
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/245879
Reviewed-by: Jamal Carvalho <jamal@golang.org>
This change updates the side navigation component to be in line
with the product spec. Notably, scrolling will no longer affect
the currently selected navigation item.
A mobile view is also implemented.
This change also implements some changes needed to ensure the tree
remains accessible, with much of the keyboard navigation code
heavily influenced by Katie Hockman’s work.
Change-Id: Iab0fee771a2d335d4bcbca8ea01ea1ddb2d8b6bd
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/244546
Reviewed-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
fetchPlayUrl creates a request to golang.org/share during the fetch process which we do not want since it would make too many requests. We no longer need this code since we are generating the playUrl in the client side through a button in the frontend. The current implementation has tests for modules with examples and replaces the playlinks.
This commit also updates the tests to reflect the current playground implementation.
For golang/go#36865
Change-Id: Ie590538db2dcdb94d5aa2cdac9c72c3522b7a565
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/241259
Reviewed-by: Julie Qiu <julie@golang.org>
This CL reverts the change for a "HideButtons" field in a package
example struct. Instead of using a feature flag that we turn off and on
for displaying the new Playground buttons, we will just replace the
`display: none;` property back to `display: flex` in a future commit.
For golang/go#36865
Change-Id: Iee29c431c22dc263bda8a812dfc148fd62d77f84
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/244763
Reviewed-by: Miguel Acero <acero@google.com>
This CL adds the HTML changes for the new play button, and error message for the playground integration. Corresponding experiment/feature flag is included.
This change also adds example_test testdata for tests that verify executable and non executable examples.
For golang/go#36865
Change-Id: I3b0339f61c2e46881681cc271252499142785000
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/243222
Reviewed-by: Julie Qiu <julie@golang.org>
Previously, loadScript in base.tmpl was referring to gtmID.dataset.path,
which doesn't exist. It now refers to the correct data attribute
gtmID.dataset.gtmID.
Change-Id: I532b3f8a7f13ac3d1cd962ba45274bc730b77ac7
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/243899
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
Add a button to the worker status page that hits the /clear-cache
endpoint.
Change-Id: Ia7cbd5a4861dac2a275c81ef193d22f16a0049ae
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/243857
Reviewed-by: Julie Qiu <julie@golang.org>
There was an attempt to create a noscript tag, which only runs when JS
is disabled, using JS.
Remove it.
For golang/go#40321.
Change-Id: I99c02810ed7c299fb606259823ef9b764c525bb6
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/243858
Reviewed-by: Julie Qiu <julie@golang.org>
When there are no results, the search page now provides instructions on
how to use the frontend fetch feature when that experiment is on.
For golang/go#37002
Change-Id: I28939ca0a871defb42c43bbce3dae14b657c75c1
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/242922
Reviewed-by: Jonathan Amsterdam <jba@google.com>
After a badge is created when a user makes changes to the url
input field, the urls will dynamically update with JS enabled.
This change fixes the dynamically updated URLs.
Fixesgolang/go#40216
Change-Id: I6a484d3daf7e7e6b09b8a110339b505031b8fada
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/242737
Reviewed-by: Julie Qiu <julie@golang.org>
Examples are collapsed by default, and if one clicks on the header, they
are expanded.
However, that's not terribly obvious to a new user, since the cursor
when hovering over those collapsed example headers is the default for a
text element, the "text selection" cursor.
Fix that, keeping the list sorted.
Change-Id: Idfb7baae1dfc3ae3b6800d58e0d95de49eabf1b7
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/241017
Reviewed-by: Julie Qiu <julie@golang.org>
This change fixes the urls for the markdown snippet
on the badge generation tool. The image and documentation
urls were switched.
Fixesgolang/go#40216
Change-Id: I8bfa409019f00c79116875da1ee9755b2238250e
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/242641
Reviewed-by: Julie Qiu <julie@golang.org>
The canonical feedback link is changed to golang.org/s/pkgsite-feedback,
instead of golang.org/s/discovery-feedback, for consistency with the
project name. Both links will continue to work and redirect to the same
location.
Change-Id: I73fe7018c9d9935dcc584c4f90a82f6c07633787
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/242557
Reviewed-by: Jonathan Amsterdam <jba@google.com>
This change creates a badge generation tool page for package authors. A future change will add
documenation of this feature and a link to the about page.
Fixesgolang/go#36982
Change-Id: Ia64ba9db73ed92b853f1f955330caf93d996da91
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/241273
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Rather than displaying a truncated version on the versions tab,
display the full semantic version.
For golang/go#38542
Change-Id: I7bb6ee3e90f4ffe406cfea99996145f0d9e36f6b
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/242363
Reviewed-by: Jonathan Amsterdam <jba@google.com>
The Google Tag Manager ID is now set using an environment variable,
instead of hardcoding in our templates. This prevent users from sending
traffic data. to the GTM for pkg.go.dev by default, when they fork the
repository.
Change-Id: I5a1f985db20fd19378612593bde3f640b2b40d09
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/241742
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
The frontend now accepts POST requests, which is used for the /fetch
endpoint. The /fetch endpoint will return the standard 404 page when a
GET request is made. When a POST request is made, it will return a
plain text response.
serveDetails and serveSearch now check the request method to ensure
a GET request is being made.
Fixesgolang/go#39979.
Change-Id: Icc4d7f6ab7ebdbabdae43eab5a1c29a6446651bb
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/241378
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Begin using github.com/google/safehtml for frontend templates.
The safehtml module replaces html/template to provide more secure
template execution.
- Templates must come from constant strings or trusted sources.
This CL constructs TrustedSource values from the filesystem
paths that we use.
- Injected HTML must be constructed from known safe values. This CL
does this in some places. In others, notably the documentation, it
uses an escape hatch that we will close in a future CL.
- Identifiers must be constructed safely. We temporarily use an
escape hatch for license identifiers.
- There is a gotcha when using safehtml types: values that
resolve to the empty string do not evaluate to false in the
context of an `if`. We have to replace `.X` inside an `if`
with `.X.String` when `.X` is a `safehtml.HTML` or the like.
Still to be done:
- Remove all `legacyconversions.RiskilyXXX` calls (https://golang.org/issue/39960).
- Remove `template.HTML` from internal/fetch/dochtml (https://golang.org/issue/39959).
Change-Id: Icf4793d70cb2441ba30abd4e7394c4696be64a7b
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/240499
Reviewed-by: Julie Qiu <julie@golang.org>
This change ensures that the topmost element in view has its
corresponding navigation element selected. This is done via
two IntersectionObservers: one to handle the target element and
one to handle all the rest. This is due to the increased size of
the target element to ensure it displays properly under the
sticky header.
Various optimizations are in place to ensure that the
IntsersectionObserver callback does minimal querying of the DOM.
An up front cost of an initial indexing operation in the navigation
controller is a candidate for optimization in future work.
Change-Id: I339085e03efb4708e2739488a36cfab9cd8f1821
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/240689
Reviewed-by: Alexander Rakoczy <alex@golang.org>
Add a new section for package files containing links to the source code
files. These file links are displayed in at most 3 columns for easier
readability.
Fixesgolang/go#37863
Change-Id: Ia70b891a49fc3e27ece655bf895eb18e4c8b2373
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/240007
Reviewed-by: Julie Qiu <julie@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
The frontend fetch UI is updated with a styled button, and loading dots
to indicate that a fetch request is in progress.
The Fetch API is now used instead of AJAX to make requests.
Updates golang/go#36811
Updates golang/go#37002
Change-Id: Ia37113dd9976f8e147875371c099f7b2bfd4bd85
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/240459
Reviewed-by: Andrew Bonventre <andybons@golang.org>
This change allows a user to press the '/' key to focus the search
box, but only in the documentation view.
Fixesgolang/go#36805
Change-Id: I59af717438729e4411c5bc06fd614940475b3796
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/240297
Reviewed-by: Andrew Bonventre <andybons@golang.org>
This change updates the “sidenav” experimental navigation with the
following changes:
+ If a type has methods or functions associated with it, it is
collapsible
+ The gray “gutter” only present in the third level of nesting
+ The build footer properly spans both columns
+ The CSS is cleaned up a bit
Change-Id: I945ccb18c91107e3384c59ffa6ead93ba158db35
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/238021
Reviewed-by: Julie Qiu <julie@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
Change our content security policy (CSP) for scripts.
Instead of using a nonce, which lends itself poorly to caching, use
hashes. See https://csp.withgoogle.com/docs/faq.html, search for "CSP
hashes".
To make hashes work, the hash of every inline script must appear in
our Content-Security-Policy header.
Also, not all browsers support hashing with scripts loaded from files,
so we must dynamically load the files by using an inline script that
builds a script tag with a src attribute. (We need to do this anyway
for the Google Tag Manager script.) See the link above for a
description of the technique. It works because the CSP header mentions
'strict-dynamic', which trusts everything loaded from a trusted
script.
Ideally, we would both generate all these hashes automatically,
and check that they are all correct. This CL doesn't do that.
A followup CL will.
List of changes:
- Replace script tags with scr attributes with inline scripts that
load from the files.
- In internal/middleware/secureheaders.go, add the list of script
hashes to the CSP header.
- Remove all references to nonces.
Updates b/159711607.
Change-Id: Ia9b78ecd85e24619e758f2580a370778708b9e71
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/239897
Reviewed-by: Roberto Clapis <robclap8@gmail.com>
Reviewed-by: Julie Qiu <julie@golang.org>
Instead of generating the entire breadcrumb HTML in code, put the
static bits in details.tmpl and build the dynamic data in code.
This is not only easier to read and maintain, but it also removes
some uses of template.HTML, which we're trying to eliminate.
Change-Id: Ic2868b88d15496bbe4bccff6abb82481e7358b7d
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/240437
Reviewed-by: Julie Qiu <julie@golang.org>
Add a /poll endpoint that polls the index, but just writes
to module_version_states without enqueuing.
Add an /enqueue endpoint that is identical to /requeue. The name more
accurately reflects that it is for new modules as well as
reprocessing.
Update the worker status page to use the new endpoints.
We'll delete the old endpoints after deploying and changing the
scheduler jobs.
Updates b/158866584.
Change-Id: Id116bf9fd99fa55aaacd71bb4ca6b60770ca8812
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/239480
Reviewed-by: Julie Qiu <julie@golang.org>
Information about experiments and excluded prefixes are added to the
worker homepage.
Change-Id: I7bb7fd1eece434bd4da12e1af384b141c8a0ed41
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/239181
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Escape any strings that may come from outside the program and will
be rendered as HTML.
Also, fix some typos.
Also, put args to a cmp.Diff call in the right order.
Change-Id: I1fc6013e200326af8719b14c28a607fc7936e20a
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/239478
Reviewed-by: Julie Qiu <julie@golang.org>
This is CL finishes removing TODOs that are outdated, and
replacing internal issue links with GitHub issue links.
Fixesgolang/go#39621
Change-Id: I09e820b26864ce15404989f5c7683a71e6ed9660
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/238577
Reviewed-by: Jonathan Amsterdam <jba@google.com>
"DetailsHeader-pathInput" input, used for copying package path, was
showing up on larger displays than 1080p.
This commit fixes it by using display's width (vw) instead of rem
Fixesgolang/go#38162
Change-Id: Ide97e0308eb0cd56131507b933a7f3ed889ffc16
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/238477
Reviewed-by: Julie Qiu <julie@golang.org>
When a path page 404s, it will now render the notfound.tmpl page (once
the frontend-fetch feature flag is on), which provides a button for the
user to make a request to fetch the package.
Updates golang/go#36811
Updates golang/go#37002
Updates golang/go#37106
Change-Id: I17fedd018435e8d3e51e2a2a4a972d3cf673df56
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/753606
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
This change implements the beginnings of a sticky navigation
component on documentation pages.
It is only implemented for wide (desktop) viewports and has no
JavaScript to show selection while scrolling. That will come
in later changes as the hierarchy gets fleshed out.
This also slightly adjusts the amount of space given between
the site header and an element scrolled into view by an anchor.
Updates b/148095016
Change-Id: Id213f1dcb7a2600d5c64bf955c79e0bbc55581db
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/745552
Reviewed-by: Alexander Rakoczy <rakoczy@google.com>
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
+ Update the title suffix from go.dev to pkg.go.dev and some
incorrect usages
+ Add a meta description for SEO purposes
+ Lazy-load images in the footer (requires setting heights and
widths for both images because otherwise loading could cause
reflow
(see https://web.dev/native-lazy-loading/)
+ Use rel=noopener in places where it is not present or
where it was redundant with noreferrer. Both are not needed
(see https://web.dev/external-anchors-use-rel-noopener/)
Change-Id: I46767bd67e6db01c4d5921926381d5b32a89f018
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/752824
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
Reviewed-by: Alexander Rakoczy <rakoczy@google.com>
+ Load all JavaScript files at the end of the page so that DOM
parsing won’t be blocked by script execution.
+ Extract out Google Tag Manager script tag and place init logic in
a separate file instead of using an inscrutable, minified inline
script.
+ Add the JavaScript compilation script.
+ Update license headers to have a range so that multiple licenses
are not included in the minified source when only the date is
different.
+ Update the prettier config to avoid arrow parentheses unless they
are needed to match existing style.
Change-Id: I7331ee7fab04eb2ff45b5f59928b3e5817d35813
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/752822
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
Reviewed-by: Alexander Rakoczy <rakoczy@google.com>
This change removes Google Analytics in favor of just Google
Tag Manager since you can use the latter to send page view data
to the former.
Additionally, adds Google Tag Manager’s debugging view CSS domain
to the content security policy.
Only renders GTM resources when not in development mode.
Change-Id: I54149c378f7226e24d836c730a8fed641d9bcb54
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/751128
Reviewed-by: Julie Qiu <julieqiu@google.com>
During doc fetch, share each example to the Go playground,
then add a link to that shared example alongside the code.
Fixesgolang/go#36865
Change-Id: Iaff51f99dd0d6d4fb71463304ee7cb747f037cd7
We are no longer using go/feedback. Feedback is being
received on the GitHub issue tracker instead.
Change-Id: I3944c013cce00f808f39e161bdc05d383e150381
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/700759
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Alexander Rakoczy <rakoczy@google.com>
The header and footer content are updated.
Header:
* Solutions → Why Go
* Learn → Getting Started
* Explore → Discover Packages
* golang.org is moved to the footer
Footer, the following was removed:
- Connect: golang-weekly and r/golang
- Under About: Issue Tracker
- Share Feedback
Change-Id: Ia4714f58dec7ae3bac72c805c777b74d970bcc3c
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/695100
Reviewed-by: Jonathan Amsterdam <jba@google.com>
This changes the logic in the GodocURL middleware to use the placeholder
technique used by nonce and latest to avoid caching issues interacting
badly with the display of the “Back to godoc.org” button.
The button is shown (via CSS rules) if it has a non-empty href attribute.
Updates b/147492306
Change-Id: I978e9765df2fbf887ee89f4a30ed48a955434f0c
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/704879
Reviewed-by: Julie Qiu <julieqiu@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
This reverts commit 0cac64d3f37dcbaa5df38ca33120b7669d381691.
Reason for revert: decided to keep all content on go.dev/about in weekly meeting
Change-Id: I901bb8951858c0af8b08da29d68a2ace044d0181
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/702040
Reviewed-by: Jonathan Amsterdam <jba@google.com>
With the option to redirect automatically from godoc.org, there needs
to be a mechanism to return to godoc.org and turn it off if necessary.
Reliably knowing that a request is coming from a godoc.org redirect
is complicated as you can’t set cross-origin cookies and 3XX redirects
don’t alter the Referer header.
In order to reliably know that a request is coming to pkg.go.dev from
godoc.org, we look for a utm_source GET parameter set to 'godoc'.
If we see this, we set a temporary cookie and redirect to the
pkg.go.dev URL with the utm_source param stripped (so that it doesn’t
remain in all our URLs coming from godoc.org). If this temporary cookie
is seen, it is marked to be deleted and the correct value for the
“Back to godoc.org” link is set. The existence of this value will be
used to determine whether to show the button in the UI.
Updates b/147492306
Change-Id: I9c2e6b891ba4f23b7490c087d32583cd7f0f6ad8
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/696565
Reviewed-by: Julie Qiu <julieqiu@google.com>
On the license-policy page, remove links to licenses
that aren't on the OSI website.
If we later find links to the other licenses, it shouldn't
be hard to add them.
Fixesgolang/go#37872.
Change-Id: Icadd9128b18c4d2b408e9726d5fec7dc9c9fe4ea
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/692259
Reviewed-by: Julie Qiu <julieqiu@google.com>
The version tree builder was already overcomplicated (I wrote it), and
then our HTML got simpler, making this complication even more
unnecessary.
Also, even though it was sorting by semver it was actually implicitly
relying on the incoming sorting, because we weren't sorting by module
path.
Rip out this complication, and replace it with a relatively
straightforward loop. This assumes that versions are already sorted, but
they are.
Tested in unit tests, and using compare_pages.sh. For the latter, I
updated the diff command to ignore whitespace changes.
Fixes b/150141995
Change-Id: I52df51e1d52bf1f9efce1d5a4ec2c291efd2f317
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/683293
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Some of our licenses are no longer OSI-approved.
Change-Id: I79644cb4488d5c76416ef9f1808ae9524aa5e440
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/673874
Reviewed-by: Julie Qiu <julieqiu@google.com>
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Display some information from the config on the status
page.
Change-Id: I847ec7f350ca18e8dc3f9847342b5d91b7b961f6
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/672581
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
The GitHub issue tracker is now used to collect feedback instead of the
Feedback API.
Any code related to the Feedback API will be removed in future CLs.
Fixes b/150142572
Change-Id: I188f93418ebe78cdf8339fffa3ce8a12b2c80303
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/674931
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
To be in accordance with golang.org/wiki/CSSStyleGuide
While not noted in the CSS style guide, using the ID attribute should
only be used when a class won’t suffice (linking to a place in the page,
label “for” attribute values, etc.). Otherwise it ends up on the window
object, polluting the global namespace.
Change-Id: Ibc4954d72455b89cc284d5baa87711c9333b83fb
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/672138
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
Previously we relied on short-circuited search to jump directly to the
package page on auto-completion, but that doesn't work for standard
library packages such as fmt (perhaps it should...).
In any case, we know the package we want to navigate to -- just go
there.
Change-Id: I7518b8a2cb1b26d2d74f894f8ae2c6c5c50896f4
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/658563
Reviewed-by: Julie Qiu <julieqiu@google.com>
It's unnecessary and stutters when using experiment flags, e.g.
pkg.go.dev?experiment=experiment-autocomplete
vs
pkg.go.dev?experiment=autocomplete
Change-Id: I019727fb6bc11acb7ffc52b40a3072889f55571b
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/657885
Reviewed-by: Julie Qiu <julieqiu@google.com>
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
We have enough status codes for ETL fetches that it's hard
to understand the table on the status page. Add a description
for each code.
Change-Id: I45c225dd032a9da80d24891a3eafe523db3c8ee5
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/623924
Reviewed-by: Julie Qiu <julieqiu@google.com>