Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/pkgsite: missing anchors for "source files" and "directories" on a package page #45210

Closed
neolit123 opened this issue Mar 24, 2021 · 5 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. pkgsite/frontend Issues related to pkgsite HTML/CSS/JavaScript and frontend development pkgsite

Comments

@neolit123
Copy link
Contributor

neolit123 commented Mar 24, 2021

i could no find existing tickets for this. sorry if a dup.

What is the URL of the page with the issue?

https://pkg.go.dev/k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm

What is your user agent?

Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4350.0 Safari/537.36 

Screenshot

NONE

What did you do?

reproduction steps:

  • open this package link.
  • scroll to the bottom where "Source files" and "Directories" are.
  • there are no clickable anchors ( ¶ ) over "Source files" and "Directories", so it's not possible to link to them.

What did you expect to see?

anchors ( ¶ ) over the "Source files" and "Directories" sections for a certain package page.

NOTE: this was possible with the previous design of the go doc website.
the anchor for directories was #pkg-subdirectories

What did you see instead?

no anchors.

@rdxmb
Copy link

rdxmb commented Mar 24, 2021

@neolit123

It seems that this has changed to #section-directories

https://pkg.go.dev/k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm#section-directories

@neolit123
Copy link
Contributor Author

thanks for the info.

@neolit123
Copy link
Contributor Author

the change frompkg-subdirectories to section-directories is a minimal breaking change, which pkgsite could have avoided.
inspecting the HTML and looking at https://github.com/golang/pkgsite i think i can send a fix for the missing ¶.

@julieqiu julieqiu modified the milestones: Unreleased, pkgsite/frontend Mar 24, 2021
@julieqiu julieqiu added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Mar 24, 2021
neolit123 added a commit to neolit123/pkgsite that referenced this issue Mar 24, 2021
Package pages that contain files and directories are missing
the paragraph symbol / anchor next to them.

Add this symbol / anchor to allow linking to the tags
that have the "section-sourcefiles" and "section-directories" ids.

Fixes golang/go#45210
@gopherbot
Copy link

Change https://golang.org/cl/304649 mentions this issue: content/static/html/helpers: add anchors for directories and sourcefiles

@neolit123
Copy link
Contributor Author

sent a PR for this here:
golang/pkgsite#24

instead of pinning to the anchors to the new IDs, it might be a good idea to preserve the backwards compatibility and rename the IDs too. the diff for that would look like:

diff --git a/content/static/html/helpers/_unit_directories.tmpl b/content/static/html/helpers/_unit_directories.tmpl
index 3047e7b9..6d3d6a58 100644
--- a/content/static/html/helpers/_unit_directories.tmpl
+++ b/content/static/html/helpers/_unit_directories.tmpl
@@ -6,8 +6,9 @@
 
 {{define "unit_directories"}}
   <div class="UnitDirectories js-unitDirectories">
-    <h2 class="UnitDirectories-title" id="section-directories">
+    <h2 class="UnitDirectories-title" id="pkg-subdirectories">
       <img height="25px" width="20px" src="/static/img/pkg-icon-folder_20x16.svg" alt="">Directories
+      <a class="Documentation-idLink" href="#pkg-subdirectories">¶</a>
     </h2>
     <div class="UnitDirectories-expandButton js-expandAllDirectories">
       <button>Expand all</button>
diff --git a/content/static/html/helpers/_unit_files.tmpl b/content/static/html/helpers/_unit_files.tmpl
index 568c06f5..67c600f2 100644
--- a/content/static/html/helpers/_unit_files.tmpl
+++ b/content/static/html/helpers/_unit_files.tmpl
@@ -6,8 +6,9 @@
 
 {{define "unit_files"}}
   <div class="UnitFiles js-unitFiles">
-    <h2 class="UnitFiles-title" id="section-sourcefiles">
+    <h2 class="UnitFiles-title" id="pkg-sourcefiles">
       <img height="16px" width="12px" src="/static/img/pkg-icon-file_16x12.svg" alt="">Source Files
+      <a class="Documentation-idLink" href="#pkg-sourcefiles">¶</a>
     </h2>
     <div class="UnitFiles-titleLink">
       <a href="{{.SourceURL}}" target="_blank" rel="noopener">View all</a>

NOTE: i don't know what was the old ID for source files, was it pkg-sourcefiles?
let me know if you want this diff instead.

neolit123 added a commit to neolit123/pkgsite that referenced this issue Mar 26, 2021
Package pages are missing the paragraph symbol / anchor
for some items.

Add this symbol / anchor to allow linking to the tags
that have the "section-sourcefiles", "section-directories",
"section-readme", "section-documentation" ids.

Fixes golang/go#45210
@golang golang locked and limited conversation to collaborators Mar 29, 2022
@hyangah hyangah added the pkgsite/frontend Issues related to pkgsite HTML/CSS/JavaScript and frontend development label May 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. pkgsite/frontend Issues related to pkgsite HTML/CSS/JavaScript and frontend development pkgsite
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants