Граф коммитов

577 Коммитов

Автор SHA1 Сообщение Дата
Julie Qiu 24009e49b8 content,internal/frotend: remove CanShowDetails logic
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>
2020-10-14 14:55:55 +00:00
Julie Qiu b93097096a content,internal/frontend: remove UnitContentName
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>
2020-10-14 14:07:47 +00:00
Julie Qiu 5589703578 internal/frontend: add fetchMainDetails
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>
2020-10-13 22:27:09 +00:00
Julie Qiu 8e0499f481 content,internal/frontend: rename UnitPage.PackageDetails to UnitPage.Details
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>
2020-10-13 21:41:45 +00:00
Julie Qiu 98487e695c content: use PageType in _unit_header.tmpl and unit_details.tmpl
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>
2020-10-13 20:39:45 +00:00
Julie Qiu bc5ab13a65 content,internal/frontend: use PageTypes as actual display name
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>
2020-10-13 20:39:36 +00:00
Jamal Carvalho 5b4f2d2788 content/static: use system fonts
Removes Google fonts in favor of system fonts to
improve readability and page load performance.

Fixes golang/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>
2020-10-13 15:11:20 +00:00
Jamal Carvalho e76d081229 content/static: update metadata page back link styles
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>
2020-10-12 19:00:23 +00:00
Julie Qiu d9e229f97a content,internal: add support for stdlib pageType label
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>
2020-10-12 18:48:19 +00:00
Jamal Carvalho 3132e566af content/static: fix main page section targets
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>
2020-10-12 18:29:57 +00:00
Jonathan Amsterdam a43f4d30ac content/static/html/worker: remove finished fetches from home page
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>
2020-10-09 18:50:57 +00:00
Jonathan Amsterdam d4e3d6f391 internal/worker: remove references to EXPERIMENTS_FROM_CONFIG
Change-Id: I9805bb30691d742cf5ea7b643ad2a591d84e5b79
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/260937
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>
2020-10-09 14:58:20 +00:00
Jamal Carvalho aa97eafa24 content/static: remove icon next to source files
Removes icons from source files and adjusts
spacing of the grid for better readability.

Change-Id: I7ef7c8fc19dd641652219321f113862277be0830
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/260728
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>
2020-10-08 17:29:46 +00:00
Jamal Carvalho a4e8b2ee21 content/static: add margin to bottom of last element in nav group
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>
2020-10-08 17:29:41 +00:00
Jamal Carvalho 2063612934 content/static: add empty alt text for decorative icons
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>
2020-10-08 17:29:35 +00:00
Jamal Carvalho d62b1ef1b6 static/content: add path to copy button tooltip
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>
2020-10-08 17:29:24 +00:00
Jamal Carvalho b67566c502 content/static: fix site padding on non unit pages
Fixes the site padding on license policy, search,
search help, and homepage.

Change-Id: I88d8b00390ef968de2c993308d5337732360aa88
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/260722
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>
2020-10-08 17:28:26 +00:00
Jamal Carvalho f596f6d66a content/static: use link version in canonical URL path
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>
2020-10-08 17:28:19 +00:00
Jamal Carvalho 1e6101ed17 content/static: disable jump to modal when documentation is empty
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>
2020-10-08 17:28:12 +00:00
Miguel Acero 8d6417918a devtools/cmd/css: generate github styles in separate file
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>
2020-10-07 17:19:48 +00:00
Julie Qiu 73f2dbae4b content/static/html/helpers: change anchor links for sections
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>
2020-10-07 14:16:45 +00:00
Julie Qiu a66050b80a content/static/html/helpers: open source files in separate tab
Change-Id: I949bf5825a4d351785398c41426adaee76945ef2
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/259937
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>
2020-10-06 20:33:59 +00:00
Jamal Carvalho 9e7f3b2c56 content/static: add break word unit details
Breaks words in unit details to fix overflow issue on
portrait mobile screens.

Change-Id: I70e205c39c4454e3f65835ad9fadf363b62c438b
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/259857
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>
2020-10-06 17:38:35 +00:00
Jamal Carvalho 9e73625b7c content/static: update accordion controller init
Updates accordion controller to select active panel
on init. Opens doc panel on init for pages without
readme.

Change-Id: I4c0d190217bc109f322b6f5a09fff930bc7ac3a3
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/259801
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>
2020-10-06 17:38:25 +00:00
Julie Qiu 6d768c80ea content/static/css: increase size of h4
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>
2020-10-06 16:44:50 +00:00
Julie Qiu bc74c0ffb7 internal/frontend: trim prefix from nested modules
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>
2020-10-06 16:42:43 +00:00
Jamal Carvalho f8c85f7147 content/static: create accordion controller for sidebar
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>
2020-10-06 14:32:24 +00:00
Miguel Acero cd0bd5e540 content/static: move generated github styles to readme.css
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>
2020-10-06 00:33:29 +00:00
Jamal Carvalho 6a4d28f83c content/static: add icon to jump to button
Adds icon to jump to button in left sidebar.

Change-Id: If0abe4dd94e741f15a17571c4916c7bacbbbeb40
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/259628
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>
2020-10-06 00:19:41 +00:00
Jamal Carvalho c47c5bd4a8 content/static: readme collapse and expand without query param
Adds event listeners to collapse and expand readme
without a page reload.

Change-Id: I3eac89c55e77cf41ba5296c1dc5e02b8960dcd2e
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/259627
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>
2020-10-06 00:19:27 +00:00
Jamal Carvalho e53c44586d content,internal: add canonical path keyboard shortcut
Adds the canonical path keyboard shorcut to the unit page.

Change-Id: I3f8882db0d779674471b94d90b25f651c5dd2527
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/259626
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>
2020-10-06 00:19:13 +00:00
Jamal Carvalho 32090f4576 content,internal: update empty documentation sections
Updates template to deemphasize empty sections. Fixes
empty and non-empty view of notes sections.

Change-Id: I1fb8c130554ff9c4c92b3fea00c704155471ca07
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/259622
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>
2020-10-06 00:18:54 +00:00
Jamal Carvalho 5ab64318ef content,internal: documentation outline updates
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>
2020-10-05 20:17:52 +00:00
Julie Qiu 96718d5258 content: add external icon to play button
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>
2020-10-05 16:02:46 +00:00
Julie Qiu 2a9cd5d552 content/static/html: use a single link for licenses
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>
2020-10-05 16:02:33 +00:00
Julie Qiu 0d8d905d71 content,internal/frontend: use consistent casing for standard library
"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>
2020-10-02 22:22:45 +00:00
Jamal Carvalho b2266ec0c7 content/static: add styles for package files
Updates source files section to match design spec.

Change-Id: I5f13c90eb8e5159e778143c775f1f321a517e7f7
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/259211
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
2020-10-02 22:08:37 +00:00
Jamal Carvalho d99a9cd928 content/static: highlight active outline section in sidebar
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>
2020-10-02 19:41:58 +00:00
Jamal Carvalho 256840e901 content/static: add copy on click to unit page header
Adds copy on click code to unit page.

Change-Id: I2a7e350e002bfc5459cc9204d92690a245a4f32f
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/259201
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
2020-10-02 19:40:48 +00:00
Jamal Carvalho 7ec7293591 content/static: pad unit page anchor link targets
Adds spacing above anchor link targets on the details page to
account for sticky header.

Change-Id: Iaf1c5e1189a3cae92475ddeab1fb3fe6b9ea6e7f
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/259200
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
2020-10-02 19:40:36 +00:00
Jamal Carvalho c690f3f592 content/static: fix details sections margins
Updates margins on content sections to account for dynamic sections

Change-Id: I5f4f2970869f89949ff2fa3dca71ab3fa120112c
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/259199
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
2020-10-02 19:40:19 +00:00
Jamal Carvalho 5c3884d8a3 content,internal: fix imported by count in unit page header
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>
2020-10-02 19:39:48 +00:00
Jamal Carvalho 5ab99ebd82 content/static: fix jump to identifier input button
Generates jump to identifier list when sidebar button is clicked.

Change-Id: I10ed8cd606303af77d78774c2e0c46391199c49d
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/259198
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>
2020-10-02 19:27:00 +00:00
Julie Qiu bbd80adee6 content,internal: add source files to unit page
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>
2020-10-02 19:18:27 +00:00
Jamal Carvalho 93eb9a73ca content/static: switch jump to input for button
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>
2020-09-30 21:18:53 +00:00
Jamal Carvalho 8cc2d1307c content/static: unsticky right side bar
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>
2020-09-30 16:45:38 +00:00
Jamal Carvalho 76b67facd7 content,internal: cleanup aria-landmark values
Adjusts aria-landmark values to match updated greenlines.

Change-Id: I4573039ebf62df20a91ac3a52b1171f0d192d774
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/258258
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>
2020-09-30 16:45:28 +00:00
Jamal Carvalho 51473e3429 content/static: add title badges for command and directory
Adds badges for command and directory. Command badge
excludes package badge but others may appear together.

Change-Id: Ifbd82d620a5d0c33ca3142fd0220d9bf3558b3f9
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/258221
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>
2020-09-29 16:40:52 +00:00
Jamal Carvalho 12efbb039e content/static: truncate repository URL
Truncates the repository URL and shows full URL
tooltip on over.

Change-Id: I98bcdf6c11da57b546ca4dbd30cf4f087f4e7e28
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/258218
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>
2020-09-29 16:40:42 +00:00
Jonathan Amsterdam bbe36a9256 internal/worker: add more info to home page
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>
2020-09-29 14:53:03 +00:00
Jamal Carvalho ed2b6b22c3 content/static: drop empty details page sections with exceptions
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>
2020-09-29 14:31:10 +00:00
Jamal Carvalho 58f2885207 content/static: metadata page link update
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>
2020-09-29 14:08:54 +00:00
Jamal Carvalho 9c1943b7d7 content/static: jump to indentifier sidebar element
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>
2020-09-28 21:50:45 +00:00
Jamal Carvalho db069347ea content/static: add js-documentation class selector for jump.js
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>
2020-09-25 20:28:08 +00:00
Jamal Carvalho 0d66fc4d5e content/static: module and package page title badges
Adds badges to unit page for packages and modules.
A unit that contains both a module and package
will show both badges.

https://drive.google.com/file/d/1aXb3xGUw6fHDegdw5F_sK_Xb2N_qYjkp/view

Change-Id: I5c72694970633e84da68d6a248eb9052d6d83a17
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/257200
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
2020-09-24 20:47:01 +00:00
Jamal Carvalho e15472716d content,internal: remove safehtml.HTML pointers from unitpage struct
Removes pointers from unit page struct
replacing nil values with empty HTML values.

Change-Id: I1ada25a8ee59b41f67ba4399a37fed3301050b94
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/257197
Trust: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
2020-09-24 20:41:26 +00:00
Jamal Carvalho 484f6716e3 content/static: add back button to package data pages
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>
2020-09-24 20:39:31 +00:00
Jamal Carvalho d9ef819191 content/static: responsive layout fixes
Adds minor fixes for responsive layout to
follow updated rules in styleguide.

Change-Id: I6f2cb51a2350473199adc6b4974635c3d3b16ae5
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/257139
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
2020-09-24 20:17:07 +00:00
Julie Qiu 89b49a7abd content/static/html/pages: remove experiment executable-examples
Change-Id: I3e81ceab33e45f43db44ff65515f9aeb4e39a5a9
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/257199
Trust: Julie Qiu <julie@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
2020-09-24 19:03:13 +00:00
Jamal Carvalho 61f3346b76 content,internal: add metadata tab content to unit page
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>
2020-09-24 15:39:47 +00:00
Jonathan Amsterdam 1c8f229061 internal/worker: add cgroup memory statistics
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>
2020-09-23 21:25:02 +00:00
Jamal Carvalho 8314b73291 content/static: add unit metadata to fixed nav
Replaces tab navigation in fixed nav with unit metadata links.

Change-Id: Ib21bd7a1b473ac9af0f49220dd77db79c5d1960d
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/256819
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>
2020-09-23 20:22:58 +00:00
Jamal Carvalho 9ed9db4fd2 content,internal: fixed nav a11y updates
Uses aria-hidden to hide the duplicated content
and prevents tab navigation into child anchors.

Change-Id: I56f75bfa68e9c136254d26f28ab65e4a3ba87a9f
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/256539
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>
2020-09-23 20:22:38 +00:00
Jamal Carvalho d5eb0625a0 content,internal: separate and rename fixed header ui code
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>
2020-09-23 20:22:27 +00:00
Jamal Carvalho 20eb00166b content,internal: add the doc index to the unit page
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>
2020-09-23 20:22:13 +00:00
Jamal Carvalho d2aeefc581 content/static: update responsive panel rules
Updates breakpoints for responsive layout and
centers content with max width on large screens.

Change-Id: I981bdd944047fef13d3805b74fdcedc9e96a4212
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/256305
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>
2020-09-23 20:21:57 +00:00
Jamal Carvalho 01500ba3f8 content,internal: add sidenav and mobile nav
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>
2020-09-23 20:21:45 +00:00
Jonathan Amsterdam 235d95262a internal/worker: remove experiment update form if from config
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>
2020-09-22 15:16:18 +00:00
Jonathan Amsterdam bff646bd52 internal/fetch: make a loadshedding struct
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>
2020-09-21 20:32:09 +00:00
Jonathan Amsterdam 45eb81e124 internal/worker: compute and display stats
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>
2020-09-18 20:10:28 +00:00
Miguel Acero d24daa283b content/static/css: fix incorrect path in comments
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>
2020-09-18 16:17:59 +00:00
Jamal Carvalho 1836aa16cd internal,content: add fixed header and clean up unit page template
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>
2020-09-17 19:29:29 +00:00
Jamal Carvalho b7a364fa53 content/static: implements boilerplate for sidenav layout on unit page
Initial scaffolding of double sidebar layout on the unit page.

Change-Id: I99e56956e9a05899bd6308624185f2be259bc87e
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/255361
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>
2020-09-17 13:57:20 +00:00
Jamal Carvalho 80d96cd5ca content/static: html template and styles for directories section
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>
2020-09-16 19:39:45 +00:00
Jamal Carvalho fb6d3f0014 content/static: html template and styles for docs section
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>
2020-09-16 19:31:55 +00:00
Jamal Carvalho 65ae8f792a content/static: html template and styles for readme section
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>
2020-09-16 19:31:22 +00:00
Jamal Carvalho ddc09e6a12 content/static: update "Search Help" button on homepage with a11y fixes
This change adds various a11y fixes and reconfigures the search help button.

Updates golang/go#40624

Change-Id: Ifaad23aca326a8d88b55d0385eed16d32ddea85c
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/254878
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
2020-09-16 16:46:50 +00:00
Jonathan Amsterdam c4480d418e content/static/html/pages: link to package-adding instructions on 404
In addition to providing a frontend fetch button, link to the manual
way to add a package.

Fixes golang/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>
2020-09-16 14:14:02 +00:00
Julie Qiu a594912ed2 Revert "content/static/css: delete unused Documentation classes"
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>
2020-09-15 15:15:46 +00:00
Julie Qiu 6a12a42408 internal/frontend: remove tab=doc query param
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.

Fixes golang/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>
2020-09-15 13:38:12 +00:00
Julie Qiu dd6f8882c0 content/static/css: delete unused Documentation classes
These classes are no longer used and are deleted:

- Documentation-nav
- Documentation-toc
- Documentation-tocItem

Change-Id: I9cc35ffe252c9bd0953e3ffcac90302f03b82977
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/254749
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>
2020-09-15 01:54:50 +00:00
Jamal Carvalho 300c31bfb8 content,internal: implement redesigned header for unit page
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>
2020-09-14 20:41:21 +00:00
Miguel Acero 4be2e9ddc1 content/static: add HTML/CSS changes for nested modules in the subdirectories page
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>
2020-09-11 16:19:25 +00:00
Jonathan Amsterdam e1846b8bb9 content/static/js: prettify analytics.js
prettier seems to want this file to change.

Change-Id: Iccbe119050ebe9cb8d92252892f22581125c199c
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/254237
Reviewed-by: Julie Qiu <julie@golang.org>
2020-09-11 15:29:52 +00:00
Julie Qiu 2589034d31 content: update example searches on homepage
Change-Id: Id6ec4515a3139a581cc36151a0bb65907f9f0e64
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/254177
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-09-10 22:48:39 +00:00
Julie Qiu a5c6be2ad4 devtools/cmd/css: moved from content/static/css
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>
2020-09-09 21:13:57 +00:00
Miguel Acero c8f2699f91 content/static/css: remove commented line to enable executable examples
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>
2020-09-09 19:54:11 +00:00
Jamal Carvalho 7ccd23c20a content/static: add rejected promise tracking
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>
2020-09-08 17:26:58 +00:00
Jamal Carvalho f4642ae1ac content/static,internal/middleware: add unhandled exception tracking
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>
2020-09-02 19:14:58 +00:00
Jamal Carvalho 97f55b5d3f content,internal,third_party: adds web vitals script for metrics tracking
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>
2020-09-02 19:08:33 +00:00
Julie Qiu ecdf6e4d07 content,internal/worker: move VersionStates to /versions page
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>
2020-09-02 16:55:18 +00:00
Jamal Carvalho 3b43f7523b content/static: fixes search input focus and supports quickfind in Firefox
Fixes search input focus key on detail pages and removes the behavior
in Firefox to support quickfind.

Updates golang/go#41093

Change-Id: Iae0c8fdde0df592e7f9eeac37183b27231bb441c
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/252117
Reviewed-by: Julie Qiu <julie@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
2020-09-01 18:07:41 +00:00
Miguel Acero a611316e91 internal: add GetLatestMajorVersion banner in documentation HTML
This change creates the HTML and CSS changes necessary to show the
latest major version banner.

before (desktop): https://i.imgur.com/YaVw9c8.png
after (desktop): https://i.imgur.com/3XVQPlT.png
before (mobile): https://i.imgur.com/gj54j1o.png
after (mobile): https://i.imgur.com/Xl68EjN.png

Fixes golang/go#37765

Change-Id: I60d6818385c986f9d1ab4dcc8ff663da0e9fe3a3
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/251817
Reviewed-by: Julie Qiu <julie@golang.org>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
2020-09-01 17:45:24 +00:00
Miguel Acero 2a24ee1d3c internal/middleware: change latestversion to latestminorversion
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>
2020-08-28 13:57:26 +00:00
Miguel Acero 4d82bb1a3f content/static: expand examples automatically when clicked or navigated
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>
2020-08-25 20:55:57 +00:00
Jonathan Amsterdam 41dc6b274d internal/worker: improve home page
- 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>
2020-08-25 18:43:50 +00:00
Rahul Wadhwani 99719cd130 x/pkgsite: fix the width of Subdirectories table
The subdirectories table is overflowing for package
https://pkg.go.dev//k8s.io/kubernetes hence adding a maximum width
to the table.

Fixes golang/go#40946

Change-Id: I6166292fe0d3dfefb634491660f8408addaa3735
GitHub-Last-Rev: ea918f1e1e
GitHub-Pull-Request: golang/pkgsite#4
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/249839
Reviewed-by: Julie Qiu <julie@golang.org>
2020-08-22 00:56:00 +00:00
Jonathan Amsterdam 605d451104 content/static/html: restore GTM iframe
Add the iframe that loads Google Tag Manager when JS is disabled.
It doesn't need a nonce.

Fixes golang/go#40321.

Change-Id: I93871833c55aa41185cf5d1c2d5a759937fe79b7
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/245557
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2020-08-21 19:57:46 +00:00
Andrew Bonventre 47151e4cbe content/static,internal: allow fluid width for documentation
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#40612
Fixes golang/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>
2020-08-20 20:13:29 +00:00
Kush Patel 6440758d8a content/static,internal/frontend,internal/middleware: add 'y' keyboard shortcut to canonicalise URL with version
The address bar URL will be updated to be the canonical url of package.
Canonical url includes the module version in address bar.

Fixes golang/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>
2020-08-20 19:08:49 +00:00
smasher164 b0853e144b content/static/css: add word-break to filenames in documentation
In the "Package Files" section, filenames longer than the
column-limit overflow onto the next column.
See https://i.imgur.com/5SrSWaZ.png.

This change fixes this behavior by adding a word-break to
the files list.
See https://i.imgur.com/rw8anB9.png.

Fixes golang/go#40889.

Change-Id: I716066644436576063779f33e56e15f7eb2f3f4f
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/249122
Reviewed-by: Julie Qiu <julie@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
2020-08-19 21:28:11 +00:00
Andrew Bonventre a1b9579989 content/static: fix various issues with homepage
+ 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>
2020-08-13 20:17:53 +00:00
Andrew Bonventre 658a7a46d3 content/static,internal/fetch/dochtml: expand all nav elements by default
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#40612
Fixes golang/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>
2020-08-13 20:17:46 +00:00
Miguel Acero 350fd05e0b content/static: fix css margins for playground examples
The changes here will not appear until the display: none; experiment
flag is removed

If a playground example doesn't have an output and is accompanied by
another example right below, currently there is no margin that separates
the dropdown div and code input div above it. This change adds a
margin-top to the dropdown.

i.e: Non-executable example with no output
https://pkg.go.dev/github.com/prometheus/client_golang/prometheus?tab=doc#example-Timer
before: https://i.imgur.com/SpCNKQj.png
after:  https://i.imgur.com/iIr6ThE.png

If a playground example doesn't have an output, currently there is no
margin that separates the button and the code input div above it. This
change adds a margin-top on the button container.

i.e: Executable example with no output.
https://pkg.go.dev/cloud.google.com/go?tab=doc#example-package-ApplicationDefaultCredentials
before: https://i.imgur.com/yFMkKrt.png
after:  https://i.imgur.com/UkmqiHJ.png

The reason the margin-top in the button container doesn't add onto the
margin-bottom in an example with an output is because of margin
collapsing that occurs between margin top and bottom properties. This is
also true for the dropdown margin-top when the div above the dropdown is
not the code input div.

i.e: Executable example with output the before and after will remain the
same https://i.imgur.com/hSzjvBn.png

i.e: Dropdown with paragraph element above the before and after will
remain the same https://i.imgur.com/niyfG7B.png

For golang/go#36865

Change-Id: I5a271cb6cb899fcec6cbd22920e885c69c20b52b
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/247401
Reviewed-by: Julie Qiu <julie@golang.org>
2020-08-07 19:50:27 +00:00
Julie Qiu 7b8f96c078 content,internal/worker: create versions page
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>
2020-08-07 13:14:19 +00:00
Andrew Bonventre 7acb4c684a content/static: properly disable details tabs
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.

Fixes golang/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>
2020-08-05 16:17:55 +00:00
Jonathan Amsterdam 2053b32a64 internal/frontend, content/static: check for insecure HTML ids
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>
2020-08-04 21:32:41 +00:00
Jamal Carvalho f4260bbd5d content/static,internal/experiment: remove deprecated homepage code
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>
2020-08-04 16:47:06 +00:00
Andrew Bonventre f177a8276c content/static/css: hide search text in header on small viewports
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>
2020-08-04 14:35:38 +00:00
Andrew Bonventre 25a3780d03 content/static/css: preserve casing of version in fixed header
Updates golang/go#40504

Change-Id: I74d1b5130f141e9db033ebec2a9ef309cd2e0229
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/246578
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
2020-08-04 14:35:34 +00:00
Andrew Bonventre f77b40c9ad content/static/css: update target padding and restrict to details pages
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>
2020-08-04 14:35:28 +00:00
Andrew Bonventre d1e3806277 content/static/css: constrain fixed position hack to mobile Safari
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#40504
Fixes golang/go#40552
Fixes golang/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>
2020-08-04 00:32:57 +00:00
Julie Qiu 2e0825b49f internal/fetch/dochtml: add Package Files to sidenav
Change-Id: I0d7bbc470adf4974c5ede6d97ce8d2f52aa2a68c
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/246438
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2020-08-03 17:23:50 +00:00
Julie Qiu 31bd5da443 content: change "POPULAR SEARCHES" to "EXAMPLE SEARCHES"
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>
2020-08-03 14:24:29 +00:00
Julie Qiu 6770e0a2cd content: display documentation source files
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>
2020-08-03 13:59:44 +00:00
Andrew Bonventre 02388aa5df content/static,internal/frontend: add more granular page types
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>
2020-07-30 19:32:45 +00:00
Andrew Bonventre 98472f3dd8 content/static,devtools,internal: update header to spec
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.

Fixes golang/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>
2020-07-30 19:31:21 +00:00
Jamal Carvalho 2c7f09d857 content/static,internal/worker: add experiment rollout update form to worker page
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>
2020-07-30 19:31:17 +00:00
Miguel Acero 11298021f9 content/static,internal: add JS functionality to the new embedded playground
This CL implements a "play button" for each example in a given package
that redirects to play.golang.org.

This code is based on https://golang.org/lib/godoc/playground.js, it was
modified to remove the dependence on jquery and bootstrap, as well as
removing DOM creation to prevent jittering of the website.

Example behavior: https://i.imgur.com/NcGO3kx.gif

For golang/go#36865

Change-Id: Ic17ebd038561ef4dabbd139f6fa2e378968b01a1
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/243699
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2020-07-30 16:59:53 +00:00
Julie Qiu 9884140fac content,internal: update text in fetch.tmpl
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>
2020-07-30 16:25:23 +00:00
Jamal Carvalho f6dd23f904 content/static: remove + symbol from popular search terms link
Fixes a typo in the popular search term links.

Change-Id: Idce1750fafd8387dab2dd9084e15d8b9b087468a
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/245881
Reviewed-by: Julie Qiu <julie@golang.org>
2020-07-30 15:04:18 +00:00
Julie Qiu aa8a734702 Revert "content: update text in fetch.tmpl for 404s"
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>
2020-07-30 14:59:04 +00:00
Julie Qiu 369bd985a3 content: update text in fetch.tmpl for 404s
For golang/go#36811
For golang/go#37002

Change-Id: I1853ecf2798e717589bb81ad0d749a3f814b55ec
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/245646
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-07-30 14:32:41 +00:00
Julie Qiu 43e9c6235d content: center text in h3.FetchMessage
For golang/go#36811
For golang/go#37002

Change-Id: I3438a8d72617f3c7af88310469b4799a5539616e
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/245401
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
2020-07-29 14:05:17 +00:00
Julie Qiu 76af5fd4f8 content: alphabetize classes with prefix Fetch
Class names with the prefix "Fetch" are alphabetized relative
to each other. No changes are made to the CSS.

For golang/go#36811
For golang/go#37002

Change-Id: I662829fd50f1e1634cc891ba50c4bf1d4f9ac0bd
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/245437
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-07-29 11:56:47 +00:00
Andrew Bonventre 2de09db4af internal/fetch/dochtml,content/static: update sidenav to be in spec
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>
2020-07-27 18:35:54 +00:00
Miguel Acero 71e1881af9 internal/fetch: remove fetchPlayUrl implementation
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>
2020-07-27 15:23:56 +00:00
Miguel Acero 843c57d22a internal/fetch: revert HideButtons field experiment flag
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>
2020-07-25 00:14:29 +00:00
Miguel Acero e13513c87d content/static: add CSS styling to the new embedded playground
This CL adds the CSS styling for the new playground examples. It is
currently under a feature flag, so the CL won't make any visible changes to the
website yet.

Without error: https://i.imgur.com/OK4V0sU.png
With error: https://i.imgur.com/sfqhZub.png

For golang/go#36865

Change-Id: I8d0e2aeeb4076bb863d36887bfe8cb0d791a1f25
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/243638
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2020-07-24 07:16:08 +00:00
Jamal Carvalho 46a7831d90 content/static, internal/experiment, internal/frontend: update pkg.go.dev homepage
We are updating the homepage. This change
implements the new homepage behind the "new-homepage" experiment.

https://drive.google.com/file/d/1UPRElFaBV_YRRyGH84xBJw0uMSyK2G1n
https://drive.google.com/file/d/1mt88Ljvh8WFiaabecfaRFZQUfR4sHr_i

Change-Id: I149c5ee2a08b943c69f848729f78b9dd9ccdb9fc
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/243702
Reviewed-by: Julie Qiu <julie@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2020-07-23 19:25:39 +00:00
Miguel Acero b973c9e73d internal/fetch: modify the documentation HTML/CSS to a play button for executable examples
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>
2020-07-22 14:05:23 +00:00
Julie Qiu 817a08e341 content: fix bug referring to gtmID.dataset.path
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>
2020-07-21 17:46:19 +00:00
Jonathan Amsterdam 9ecc8fe356 content/static/html/worker: add Clear Cache button
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>
2020-07-21 12:38:30 +00:00
Jonathan Amsterdam ab821ecd42 content/static/html: remove bad JS
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>
2020-07-21 12:35:55 +00:00
Julie Qiu e28af9a0fe content: update search page for no results
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>
2020-07-20 19:29:04 +00:00
Jamal Carvalho 66d7d7c20c content/static: fix badge dynamic update
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.

Fixes golang/go#40216

Change-Id: I6a484d3daf7e7e6b09b8a110339b505031b8fada
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/242737
Reviewed-by: Julie Qiu <julie@golang.org>
2020-07-15 14:59:53 +00:00
Daniel Martí 130a4e343b content: clarify that "expand example" is clickable
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>
2020-07-14 21:43:33 +00:00
Jamal Carvalho 2f4e4a8df3 content,internal: fix markdown badge snippet
This change fixes the urls for the markdown snippet
on the badge generation tool. The image and documentation
urls were switched.

Fixes golang/go#40216

Change-Id: I8bfa409019f00c79116875da1ee9755b2238250e
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/242641
Reviewed-by: Julie Qiu <julie@golang.org>
2020-07-14 20:51:22 +00:00
Julie Qiu 47787dc2f0 content,README.md: use golang.org/s/pkgsite-feedback
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>
2020-07-14 19:48:04 +00:00
Jamal Carvalho d37103e11f content,internal: add badge generation for package authors
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.

Fixes golang/go#36982

Change-Id: Ia64ba9db73ed92b853f1f955330caf93d996da91
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/241273
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2020-07-14 18:56:54 +00:00
Julie Qiu ca40ea1770 internal/frontend: display full semantic version on versions tab
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>
2020-07-14 13:18:05 +00:00
Julie Qiu a31de3da16 all: set GoogleTagManagerID using environment variable
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>
2020-07-13 18:29:39 +00:00
Julie Qiu 71c954f70e content,internal: allow POST requests for fetch endpoint
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.

Fixes golang/go#39979.

Change-Id: Icc4d7f6ab7ebdbabdae43eab5a1c29a6446651bb
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/241378
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-07-08 13:28:41 +00:00
Jonathan Amsterdam 073d8fe5ef internal/frontend: use safehtml
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>
2020-07-07 17:14:32 +00:00
Andrew Bonventre 683c518140 content/static: select side navigation element when scrolling
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>
2020-07-07 16:33:03 +00:00
Julie Qiu 01357d1483 content: remove duplicate class .Documentation-tocItem--types
Change-Id: Ifc547bb506b2bf876a1913807d1046b70cd33eb9
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/241160
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-07-06 21:54:58 +00:00
Julie Qiu 29325727ba content: set Documentation-tocItem--funcsAndTypes to display:none
Fixes golang/go#40078

Change-Id: Ie6a563a225747d744ac092d62f7cff234b2ec13f
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/241157
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-07-06 20:28:32 +00:00
Jonathan Amsterdam b770da1d30 content/static/js: prettify fetch.js
Change-Id: Ic66c947110edbc63b93a0fb913de0fa142b2f736
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/241058
Reviewed-by: Julie Qiu <julie@golang.org>
2020-07-06 14:10:47 +00:00
shaquilleq 20e1c1312d internal/fetch: add explicit package file links to doc tab
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.

Fixes golang/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>
2020-07-01 20:41:41 +00:00
Julie Qiu 993436f73a content: update frontend fetch UI
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>
2020-07-01 17:52:00 +00:00
Kush Patel 87b93cfbfe content/static: add keyboard shortcut '/' to focus search box
This change allows a user to press the '/' key to focus the search
box, but only in the documentation view.

Fixes golang/go#36805

Change-Id: I59af717438729e4411c5bc06fd614940475b3796
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/240297
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2020-06-30 16:33:31 +00:00
Andrew Bonventre 417bf46857 content/static: update doc sidenav with collapsible funcs and types
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>
2020-06-30 13:50:27 +00:00
Jonathan Amsterdam 1940919ec2 many: change CSP to use hashes instead of nonces
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>
2020-06-29 21:25:26 +00:00
Jonathan Amsterdam a269441684 internal/frontend: move breadcrumb HTML to template
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>
2020-06-29 21:25:13 +00:00
Jonathan Amsterdam 08e8e660a6 internal/worker: add /poll and /enqueue endpoints.
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>
2020-06-26 21:13:17 +00:00
Julie Qiu 461688d812 content,internal: add experiments and excluded to worker homepage
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>
2020-06-26 15:00:56 +00:00
Jonathan Amsterdam 8acea93dd9 internal/{source,frontend}: escape HTML
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>
2020-06-23 13:36:35 +00:00
Julie Qiu e648379573 all: clean up issue links
This is CL finishes removing TODOs that are outdated, and
replacing internal issue links with GitHub issue links.

Fixes golang/go#39621

Change-Id: I09e820b26864ce15404989f5c7683a71e6ed9660
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/238577
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-06-23 12:51:41 +00:00
nyaascii 80f9cec73c content/static/css: hide pathInput element on larger displays
"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

Fixes golang/go#38162

Change-Id: Ide97e0308eb0cd56131507b933a7f3ed889ffc16
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/238477
Reviewed-by: Julie Qiu <julie@golang.org>
2020-06-17 15:58:02 +00:00
Julie Qiu 2b3b7078c6 content: add banner in support of our black community
Change-Id: I2bd5c3632a1fdbf0779e8181417950c7f9408146
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/767238
Reviewed-by: Russ Cox <rsc@google.com>
Reviewed-by: Andrew Bonventre <andybons@google.com>
2020-06-11 17:59:32 -04:00
Julie Qiu 9c2d7b5fc8 content: update files from running prettier
`./all.bash prettier` was run and the following files were updated.

Change-Id: I312c4371c96ba58f92482fec501fd796bf315857
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/766269
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-06-09 22:56:38 +00:00
Julie Qiu 348a802a41 content: update license policy to use GitHub for feedback
Change-Id: I1da6cee0141c2a6ae76739c74972ace06bcc9588
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/766406
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-06-09 22:56:20 +00:00
Julie Qiu ccee67b0a2 content,internal/frontend: make a request to /fetch on path 404
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>
2020-06-04 15:56:15 +00:00
Andrew Bonventre bd43c94d8d all: add initial side navigation UI experiment
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>
2020-06-02 16:31:09 +00:00
Andrew Bonventre 5ab9d78a3e all: clean up some issues noticed by Lighthouse
+ 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>
2020-05-26 17:21:35 +00:00
Andrew Bonventre dec9db9ed0 content/static: rearrange loading order of scripts plus cleanup
+ 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>
2020-05-26 17:03:21 +00:00
Andrew Bonventre dc3877069a internal/frontend, content/static/html: use GTM only
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>
2020-05-20 22:27:41 +00:00
Sameer Ajmani 90861f00a2 internal/fetch: add playground links for examples
During doc fetch, share each example to the Go playground,
then add a link to that shared example alongside the code.

Fixes golang/go#36865

Change-Id: I541774af5f29e0bdbb9bd812496cc6e4fd39fcb6
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/715584
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-04-13 21:35:11 +00:00
Sameer Ajmani 99709dcc27 Revert "internal/fetch: add playground links for examples"
This reverts commit 4a41701448.

Reason for revert: accidental merge

Change-Id: Id8ef4321a260a0f75587ddad320865aaf1539772
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/715580
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-04-10 18:55:07 +00:00
Sameer Ajmani 4a41701448 internal/fetch: add playground links for examples
During doc fetch, share each example to the Go playground,
then add a link to that shared example alongside the code.

Fixes golang/go#36865

Change-Id: Iaff51f99dd0d6d4fb71463304ee7cb747f037cd7
2020-04-10 11:12:14 -04:00
Julie Qiu 3b4ad7554f content,internal/middleware: remove Feedback API
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>
2020-04-07 15:34:44 +00:00
Julie Qiu d4851b4655 content: update header and footer content
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>
2020-04-06 17:09:52 -04:00
Andrew Bonventre 9ec03558a7 discovery: tweak godoc.org URL middleware to use placeholder
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>
2020-04-06 17:09:52 -04:00
Julie Qiu 28f2ccbd9b Revert "content: add pkg.go.dev/about"
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>
2020-04-06 17:09:52 -04:00
Andrew Bonventre 7796a18097 discovery: add UI for “Back to godoc.org” button
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>
2020-04-06 17:09:52 -04:00
Sameer Ajmani e082590e67 content: add a margin around pre blocks in examples
Revert the template change from CL 698080.

Fixes #37816

Change-Id: I1ac7957449d44c0ec3c28fe637f32972011aa792
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/698520
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-04-06 17:09:52 -04:00
Julie Qiu a62e10fd3a content: add pkg.go.dev/about
Fixes b/151943636

Change-Id: I167913003e9edbb37b51844e58ad72f4c39ff268
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/696059
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-04-06 17:09:52 -04:00
Andrew Bonventre 1832788466 discovery: move content/static/third_party to top-level directory
This is required per Google’s open source policies.

Change-Id: Iff06d489a30f051c024618e53f65e46d4f89df94
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/697023
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-04-06 17:09:52 -04:00
Andrew Bonventre daab3b7569 content/static: rename thirdparty directory to third_party
Updates b/150138132

Change-Id: Id8cd371dbcace53d81cae1b40ba2f8af2d08769c
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/692262
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-04-06 17:09:52 -04:00
Julie Qiu d662c033ed all: clean up references
Change-Id: I6bed81cdc23a73fafbd382e856e9bc55c391eaa7
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/692499
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-04-06 17:09:52 -04:00
Jonathan Amsterdam 24cce3461a internal/frontend: only link to OSI licenses
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.

Fixes golang/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>
2020-04-06 17:09:52 -04:00
Jonathan Amsterdam 78a4e6202e content/static/html: rename etl to worker
Updates b/150864416.

Change-Id: Iefdf9e5594c88839d6431f44e8a10032de1c00f3
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/686701
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-04-06 15:50:52 -04:00
Rob Findley 7990735245 internal/frontend: simplify building the version tree
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>
2020-04-06 15:50:52 -04:00
Julie Qiu ceb6c1021b content: always display note about how documentation was rendered
Fixes github.com/golang/go/issues/37665

Change-Id: I8af55b80d08aec64e134d52d99d00eb624dbf1bd
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/683363
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-04-06 15:50:52 -04:00
Julie Qiu 4fe4bbb6ff content: change default font to source code pro
Fixes golang.org/issue/37411

Change-Id: I4e245710f048ab72ce3ef65bea94affeaeb6254f
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/678663
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-04-06 15:50:52 -04:00
Julie Qiu c03e23db33 content/static/css: use CSS styles from GitHub
Styles used for GitHub markdown are added to our stylesheet. These
styles are taken from
https://github.com/sindresorhus/github-markdown-css/blob/gh-pages/github-markdown.css.

A command is provided to take only styles that do not apply to class
names we do not recognize.

Fixes golang.org/issue/37025
Fixes golang.org/issue/37284

Change-Id: I56328c0d18dd294290d16105bd24334e4d0caa5d
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/673158
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-04-06 15:50:52 -04:00
Jonathan Amsterdam 30d17fecd8 license_policy.tmpl: remove "OSI-approved"
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>
2020-04-06 15:50:52 -04:00
Jonathan Amsterdam e25e7f832f internal/etl: add config into to status page
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>
2020-04-06 15:50:52 -04:00
Julie Qiu 316b087120 content: use GitHub issue tracker instead of Feedback API
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>
2020-04-06 15:50:52 -04:00
Andrew Bonventre 20941adfec content/static, internal/frontend: clean up some details page JS and CSS
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>
2020-04-06 15:50:52 -04:00
Julie Qiu 4d0432c6c6 content: update search results 0 results page
https://github.com/golang/go/issues/36986#issuecomment-583464246

Change-Id: Idfd0eb2514accdd23204a8bbe7d9bbdb66cea276
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/668098
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-04-06 15:50:51 -04:00
Jonathan Amsterdam 4a397dce96 content/static/js: minimize and concatenate javascript
Change-Id: I34b94fccbade72f57c2bc33d7e5388cf114b873e
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/664687
Reviewed-by: Alexander Rakoczy <rakoczy@google.com>
2020-04-06 15:50:51 -04:00
Rob Findley a068d41c4e content: jump directly to the package on autocompletion
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>
2020-03-27 16:46:52 -04:00
Rob Findley 78bdbc12e7 content: rename the autocomplete experiment to just 'autocomplete'
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>
2020-03-27 16:46:52 -04:00
Jonathan Amsterdam d3c3b49aef internal/etl: status page improvements
- Page title includes environment
- Wider input boxes (mainly for reprocessing version)
- "GAE Versions" link opens new tab
- Better descriptions for status codes

Change-Id: I685907047951acc8bd02c00ea59c3c780a342045
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/653254
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-03-27 16:46:52 -04:00
Jonathan Amsterdam 1c9e2896c1 licenses: match filenames case-insensitively
Approved 

Fixes b/148715828.

Change-Id: I5bc87e7899cd08d408ff4798b33dc5286ff5e197
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/653253
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-03-27 16:46:52 -04:00
Julie Qiu 0438bc3501 content: use consistent font for all <code> tags
Fixes b/148383618

Change-Id: I861e10c42a518e9f503350250c1b656722465199
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/649140
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-03-27 16:46:51 -04:00
Julie Qiu 81ff962bc1 content,internal/frontend: add GoogleTagManager
Integrate Google Tag Manager, following instructions at:
https://developers.google.com/tag-manager/quickstart

Updates b/147106668

Change-Id: I2c7bab6f7477376c296cffbeb77d41ad96ddbdf9
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/626669
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-03-27 16:46:50 -04:00
Julie Qiu 7b33ae5fbe content,internal/frontend: use experiments library for autocomplete
Updates b/146052411

Change-Id: Ie109b7fafedca2c2077a03696c550b1439824879
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/620410
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-03-27 16:46:50 -04:00
Jonathan Amsterdam 3a1c21670c internal/etl: display meaning of codes on status page
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>
2020-03-27 16:46:50 -04:00