Add /reference redirect to latest version (#1849)#2115
Open
singhvishalkr wants to merge 1 commit intolinkerd:mainfrom
Open
Add /reference redirect to latest version (#1849)#2115singhvishalkr wants to merge 1 commit intolinkerd:mainfrom
singhvishalkr wants to merge 1 commit intolinkerd:mainfrom
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #1849 reports that
https://linkerd.io/reference404s. The versioned reference docs live atlinkerd.io/{version}/reference/, but a reader needs to already know the version number to find them. The same problem was solved years ago for/docsvialinkerd.io/content/docs/_index.md, which redirects through the Hugoredirectlayout to/2/getting-started/and then onward to/{latestMajorVersion}/getting-started/.This PR adds the equivalent file for
/reference/. The newlinkerd.io/content/reference/_index.mdreuses the same_default/redirectlayout withparams.redirect: /2/reference/. The existingredirect.htmltemplate (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: agh api .../contents/linkerd.io/content/referencelookup currently 404s onmain.Fixes #1849