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>
- Mention that we use licensecheck.
- Ask package users to contact package authors, rather than us.
Change-Id: I4334136d486e2acec128c35c6fc9cc1112fe6c0e
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/620961
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
A fake experiment handle is used to guard the autocomplete feature
behind a flag. It defaults to false (experiment off).
Change-Id: Ib9f26c00a6e0374277c27c605aa8c9809464623f
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/619084
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>
Previously, we were relying on GetPackage returning an error in order
for directories not to show the latest badge. Aside from making an
unnecessary database call, there are some cases where we're serving a
directory for a path, but that path is a valid package at another
version, so GetPackage(..., "latest") actually succeeds. In fact, it's
possible that the latest valid package version is actually *earlier*
than the directory version we're currently serving, which is especially
confusing for the user.
In order to be consistent about showing the badge only on module and
package pages, a new field 'PageType' is introduced on Details to expose
exactly which details handler is serving the page. This is then used in
the latestVersion function.
The new PageType field holds strictly more information than the existing
Namespace field, so Namespace was removed and all uses were updated to
use PageType.
Additionally, the order of 'packagePath' and 'modulePath' in the
latestVersion function was reversed. In all other argument lists
packagePath precedes modulePath (typically pkgPath, modulePath,
version), so this was changed purely for consistency.
Fixes b/143814014
Change-Id: I3d9fd40c44f0d3f02c38755950c3988699a00891
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/616656
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
Auto-completion is added to the search dialog, both on the home page and
in the navbar. This is achieved using autoComplete.js for autocompletion
behavior, but with heavy modification to make the component accessible.
Additionally, some DOM changes are made to support the visual styling of
the auto-completion dialog:
+ The SearchForm and Header-searchForm components are made
position:absolute.
+ Relatively positioned container components are added to control the
positioning and spacing of the search forms.
The header search form is made to have a white background, as the blue
background looked incorrect when the completion list overlaid the white
of the body content.
Fixes b/143370178
Change-Id: Ic0b527643c8c5aa6e04101082e7e630325486802
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/604267
Reviewed-by: Alexander Rakoczy <rakoczy@google.com>
When rendering a details page, the Header field can be either a Module,
Directory, or Package, and in our templates we rely on fields having
consistent meaning.
Renaming Module.Path to Module.ModulePath makes this simpler: we can
just refer to $header.ModulePath regardless of which namespace we're in.
Updates b/143814014
Change-Id: I0e3542244467af70a4ea45b43836eef8a0a52a24
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/613504
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
Add 'F' (shift-f) as an alternative to 'f' for opening
the jump-to-identifier dialog.
The intent is to give people who use screen readers
an alternative way to bring up the dialog, in case
'f' doesn't work with their screen reader.
Updates b/145609006.
Change-Id: Ia0562f62097fda9fa22d6ba1f542e55b04c22c91
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/611025
Reviewed-by: Julie Qiu <julieqiu@google.com>
Link to our license policy whenever we say we can't
display something due to license restrictions.
For overview.tmpl, I had to inline the empty-content template because
I couldn't figure out how to pass HTML that didn't get escaped.
Change-Id: I803f9624892fa32d94c4c662c33f769c9f8e0693
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/611024
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>