Skip to content

Commit

Permalink
Fixed old-version banner so it links to the latest version on non-sec…
Browse files Browse the repository at this point in the history
…tion pages

Signed-off-by: Travis Beckham <[email protected]>
  • Loading branch information
travisbeckham committed Jul 31, 2024
1 parent 60152a1 commit 7617fab
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions linkerd.io/layouts/partials/docs.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
{{ $latestVersion := site.Params.latest_linkerd2_stable_version }}
{{ $pathParts := split .page.Path "/" }}
{{ $docsVersion := index $pathParts 1 }}
{{ $latestDocsPath := delimit (append (after 2 $pathParts) (slice "" $latestVersion)) "/" }}
{{/*
By default, not all pages are backed by a file, including top level section
pages, so verifying file existence before processing `.Path`
*/}}
{{ $docsVersion := "" }}
{{ $latestDocsPath := "" }}
{{ with .page.File }}
{{ $pathParts := split .Path "/" }}
{{ $docsVersion = index $pathParts 0 }}
{{ $latestDocsPath = delimit (append (after 1 $pathParts) (slice "" $latestVersion)) "/" }}
{{ end }}

<div class="wrapper docs">
<div class="columns is-fullwidth is-gapless is-tablet">
Expand Down Expand Up @@ -36,7 +44,7 @@
</div>
<div class="message-body">
This documentation is for an older version of Linkerd.
{{ if (fileExists $latestDocsPath) }}
{{ if and $latestDocsPath (fileExists $latestDocsPath) }}
You may want the <a href="{{ relref .page $latestDocsPath }}">Linkerd {{ $latestVersion }} (current)
documentation</a> instead.
{{ else }}
Expand All @@ -51,7 +59,7 @@
</div>
<div class="message-body">
This documentation is for the <a href="/releases/">edge</a> release of Linkerd.
{{ if (fileExists $latestDocsPath) }}
{{ if and $latestDocsPath (fileExists $latestDocsPath) }}
You may want the <a href="{{ relref .page $latestDocsPath }}">Linkerd {{ $latestVersion }} (current)
documentation</a> instead.
{{ else }}
Expand Down

0 comments on commit 7617fab

Please sign in to comment.