internal/frontend: use link version for breadcrumbs
Rather than computing the linkVersion in displayBreadcrumbs, compute
this value in breadcrumbs, where it is used.
Change-Id: Id8bcfd33a09180aecabbace1bb5a5502fef8f5c1
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/259620
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>
diff --git a/internal/frontend/header.go b/internal/frontend/header.go
index bf5d7c2..cdf3c14 100644
--- a/internal/frontend/header.go
+++ b/internal/frontend/header.go
@@ -189,7 +189,7 @@
for i := 1; i < len(dirs); i++ {
href := "/" + dirs[i]
if requestedVersion != internal.LatestVersion {
- href += "@" + requestedVersion
+ href += "@" + linkVersion(requestedVersion, modPath)
}
el := dirs[i]
if i != len(dirs)-1 {
diff --git a/internal/frontend/unit.go b/internal/frontend/unit.go
index 432a00d..67161d3 100644
--- a/internal/frontend/unit.go
+++ b/internal/frontend/unit.go
@@ -328,13 +328,7 @@
// displayBreadcrumbs appends additional breadcrumb links for display
// to those for the given unit.
func displayBreadcrumb(unit *internal.Unit, requestedVersion string) breadcrumb {
- v := requestedVersion
- if unit.ModulePath == stdlib.ModulePath {
- // TODO: Fix definition of requestedVersion, so that the
- // requestedVersion is the goTag, not the resolved semantic version.
- v = goTagForVersion(requestedVersion)
- }
- bc := breadcrumbPath(unit.Path, unit.ModulePath, v)
+ bc := breadcrumbPath(unit.Path, unit.ModulePath, requestedVersion)
if unit.ModulePath == stdlib.ModulePath && unit.Path != stdlib.ModulePath {
bc.Links = append([]link{{Href: "/std", Body: "Standard library"}}, bc.Links...)
}