Skip to content

Add /reference redirect to latest version (#1849)#2115

Closed
singhvishalkr wants to merge 1 commit into
linkerd:mainfrom
singhvishalkr:redirect-reference-to-latest
Closed

Add /reference redirect to latest version (#1849)#2115
singhvishalkr wants to merge 1 commit into
linkerd:mainfrom
singhvishalkr:redirect-reference-to-latest

Conversation

@singhvishalkr
Copy link
Copy Markdown

Issue #1849 reports that https://linkerd.io/reference 404s. The versioned reference docs live at linkerd.io/{version}/reference/, but a reader needs to already know the version number to find them. The same problem was solved years ago for /docs via linkerd.io/content/docs/_index.md, which redirects through the Hugo redirect layout to /2/getting-started/ and then onward to /{latestMajorVersion}/getting-started/.

This PR adds the equivalent file for /reference/. The new linkerd.io/content/reference/_index.md reuses the same _default/redirect layout with params.redirect: /2/reference/. The existing redirect.html template (linkerd.io/layouts/_default/redirect.html) rewrites /2/{path} into /{latestMajorVersion}/{path} at render time, so this entry will keep pointing at the current latest reference docs every time a new minor ships, without any further code change.

No existing pages live under /reference/, so there is no collision: a gh api .../contents/linkerd.io/content/reference lookup currently 404s on main.

Fixes #1849

Problem

linkerd.io/reference returns 404. Other versions' reference docs live
at linkerd.io/{version}/reference/ but the unversioned /reference/
path has no landing page, so a reader needs to know the version number
before they can navigate to the API reference.

Solution

Add linkerd.io/content/reference/_index.md that uses the existing
redirect layout to forward /reference/ to /2/reference/. The
redirect.html template rewrites /2/{path} into
/{latestMajorVersion}/{path} on render, so this stays current as new
versions ship without further code changes. Mirrors the existing
/docs -> /2/getting-started/ redirect at content/docs/_index.md.

Fixes linkerd#1849

Signed-off-by: Vishal Kumar Singh <vishal.kr.singh2021@gmail.com>
@travisbeckham
Copy link
Copy Markdown
Collaborator

Thank you so much for taking the time to address this. This highlighted a much bigger improvement that needed to be made that would enable permanent urls for all docs in the latest version, not just the reference section.

This improvement has been made in PR #2116 , and we now have a permanent url for the latest reference page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

linkerd.io/reference could redirect to latest reference docs

2 participants