Makes expandAll toggle for ExpandableRowsTableController
optional to fix a type error in unit.ts
For golang/go#43359
Change-Id: I5680283ea71d0aabde3511c76ac8ee39ab288905
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/299257
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>
Moves analytics, utm_source and base site code to a new file called
site.ts. This file contains all initialization scripts for pkg.go.dev
that should be run before other scripts are added to the page.
For golang/go#43359
Change-Id: I49dbf7afdaffa9c0638266ae58e1059802936fc1
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/299251
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
ES2020 adds support for optional chaining to the JavaScript
language and has been adopted in all major browsers. However,
support for optional chaining is not universal so we are seeing
some JavaScript errors related to the syntax. Downgrading our
build target to ES2019 to prevent these errors in older browsers.
Change-Id: I7bb08d26ab6fe54a4341db5a517356573bce6e1d
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/295932
Trust: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
The example playgrounds now clear the existing output before
printing new output when the Run button is pressed. Ensures
the loading message is cleared when example code produces no
output. Additionally, the output box will now display for all
examples because they are editable. Examples that don't
initially have output can be changed to produce output.
Change-Id: Ie70f98ab505a28705e2ea65869bddb84ef6927ec
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/295192
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Example playgrounds on documentation pages are
editable and interactive. Below each example code
snippet on the documentation page we’ll display
buttons to run, format, and share the snippet.
Pressing run displays the result output below the
code snippet, format will reformat the code inline
and share will display a share link below the code
snippet and open the playground in a new window.
For golang/go#44090
Change-Id: I56d635e60a89a382974ef7100eb4348dbbb4b893
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/293833
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
Migrates playground.js code to TypeScript in preparation
of enhancements to the example playgrounds.
Change-Id: I185e9fe05c0e7bf3deb683f1583f9a26b4960237
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/288991
Trust: Jamal Carvalho <jamal@golang.org>
Trust: Julie Qiu <julie@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
Requests originating from gopls and redirected from godoc.org have a
"utm_source=gopls" and "utm_source=godoc" query param in the URL,
respectively.
If we see this, we will strip the query param on page load, so that so
that it doesn’t remain in all our URLs coming from these sites.
This is done to page load so that requests are still sent to GA with
these utm_sources intact.
For golang/go#42602
Change-Id: I63defcb50ba54b1e476de0f0db63c23494000046
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/270800
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>
Theres a bug in the navtree where if the README
headings are expanded and the jump to identifier
tool is used, both the README headings and the
documentation headings will be visible. This change
closes the inactive top level nav when a new item
is selected.
Change-Id: I3c88f0654039bb3b7ca1725f0c02918a3780061d
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/283956
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Removes separate directory for TypeScript files and
updates frontend tools to match updated directory
structure. TypeScript files will be co-located with
the JavaScript files making easier to identify files
that have already been migrated to TypeScript.
Change-Id: I4deb5b22c550fc34c98529bbe19bec6d28759a02
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/282377
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>
Now that goldmark and readme-outline experiments are fully
rolled out we can remove related legacy code.
Change-Id: Ibb1a653726a4a58d5a26b2db308778a0c5ddcffc
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/281674
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
Updates badges form to mirror behavior of search input.
If a module url is entered with an http(s):// prefix
the prefix will be stripped and the resulting path is
used in the badge URL. Removes the interactive update
in lieu of an update button after the badge has been
created. Live updates with our scheme removal logic
lead to a strange experience when changing urls after
a badge was already created.
Fixesgolang/go#43458
Change-Id: I1732a3eeb54f475c90f0b6f5f2976fb25cbfe039
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/281712
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
Autocomplete no longer works in dev, and the experiment is not active
in any other environment.
Change-Id: I8865539862a4d1b84bf91641e7662d4926d30488
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/279133
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Trust: Julie Qiu <julie@golang.org>
Adds a section to the right sidenav highlighting
metadata about modules to help reinforce best practices
for maintaining modules on the pkgsite. This feature is
implemented behind the "unit-meta-details" experiment.
For golang/go#43129
Change-Id: I2755756b10f5cb1b1d1a2f9caf42c90fc715ff3b
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/277854
Trust: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
A .svg suffix is added to the end of the badge image URL path, to
indicate that the link is an SVG image.
Test for "?tab=imports" in TestBadgeHandler_ServeBadgeTool are now
deleted, since that use case is no longer supported.
Change-Id: I1f159dad37abe94c5e3ce6f9b65f3b36cec977bf
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/275435
Trust: Julie Qiu <julie@golang.org>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
The alt text is changed from PkgGoDev to "Go Reference" to match the
alt text with the badge text and improve accessibility.
Change-Id: I53edeb706fa802a5a347004345fea60987f306ff
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/275304
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>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
Removes static content used in the legacy package, directory, and module pages.
Moves sidenav and readme styles requests into details page so they are not
loaded on all page requests.
Change-Id: Ief93cb1ec21939dadf0f9f6a0c47abaf4284b2a9
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/272827
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
The browser find text feature will search through text
even when it is hidden. This change will expand the readme
when the text search feature is activated on the unit page.
Fixesgolang/go#42653
Change-Id: I15a97724c21a975ee04f409a26e409e3ed7efd76
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/272608
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
The default id generator in goldmark is limited to ascii characters
and keeps the text content from inlined images. This change removes
the images from heading ids and preserves all unicode alphanumeric
characters.
Change-Id: I8657dc4aa3f2b8d5b4f5a519992ed85f67d0b7a4
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/272447
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
This change adds the readme headings to the outline
in the sidenav and unifies the navigation tree into
a single accessible structure.
Styles within the tree are based on the accessiblity
tree structure. This will make it easier to see when
updates to the tree are inserted incorrectly because
they'll be matched by visual breakages on the page.
Sidenav and readme click handlers are updated to
ensure that when an outline item is clicked the
corresponding content is visible.
Change-Id: Ie6062c24f37bec9fffe242aa1398ec815606c613
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/271319
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>
Code in motion. Outline code will be updated to support
a new outline layout that contains the readme headings.
Change-Id: I58d4778f01dd9e1347197f1a8d2d5cd16b35d7a8
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/271318
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>
At the moment, this error appears in the console on pages without a
Source Files section:
Uncaught TypeError: Cannot read property 'setAttribute' of null
at unit.js:54
It doesn't seem like js-filesOption is being used anywhere, so this
reference is deleted in unit.js.
Change-Id: I8db74ae996d99b1ffef143e5b8ffdc78ba1d9cbe
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/270801
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
Trust: Julie Qiu <julie@golang.org>
Currently, "jump to" filters ids by a simple substring match, ordering them alphabetically. This change makes the filtering more powerful by prioritizing exact matches over prefix matches and then substring matches.
E.g. if a package has a symbol named `Foo`, when the Jump dialog is searched for `Foo` it should now come before ids like `BarFoo` (which would previous come on top because of alphabetical order).
This change also removes the use of regexps in the list, using simpler string matching.
Fixesgolang/go#42489
Change-Id: I2f564d28767a27c68ef01ab246aaf4b8755bb902
GitHub-Last-Rev: cd6ca249ce
GitHub-Pull-Request: golang/pkgsite#16
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/269278
Reviewed-by: Jamal Carvalho <jamal@golang.org>
Trust: Julie Qiu <julie@golang.org>
Time to First Byte and First Contentful Paint can be useful as proxy
or supplemental metrics when diagnosing specific issues. For now we'll
focus on the Core Web Vitals to reduce the number of events sent to
Google Analytics. This will be important as traffic to the site grows
so that we do not hit any event caps.
Change-Id: I3c7514d630b65b66d2884efb9f0c1b9ace71630d
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/268118
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>
Fixes readme expand logic so that it will open
when an element within it is given focus through
keyboard events.
Change-Id: I66cd406137b6162b3bd8415b5c186f87f0886ee2
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/264627
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>
When the doc for a package does not contain an index
we disable the jump to identifier dialog. This change
prevents both the button in the sidebar and the k key
from opening the modal.
Change-Id: I48e17a4f57f066bf80fdc5452e900f9803ecf933
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/264199
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>