-
Notifications
You must be signed in to change notification settings - Fork 15k
feat: add dynamic latest API redirects via Hugo templating #52591
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
base: main
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
✅ Pull request preview available for checkingBuilt without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
/area web-development |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't use a 301 redirect, but apart from that this is basically good to merge.
layouts/index.redirects
Outdated
/docs/reference/generated/kubernetes-api/latest/ /docs/reference/generated/kubernetes-api/{{ $latest }}/ 301 | ||
/docs/reference/generated/kubernetes-api/latest/* /docs/reference/generated/kubernetes-api/{{ $latest }}/:splat 301 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We plan to do releases in the future, so:
/docs/reference/generated/kubernetes-api/latest/ /docs/reference/generated/kubernetes-api/{{ $latest }}/ 301 | |
/docs/reference/generated/kubernetes-api/latest/* /docs/reference/generated/kubernetes-api/{{ $latest }}/:splat 301 | |
/docs/reference/generated/kubernetes-api/latest/ /docs/reference/generated/kubernetes-api/{{ $latest }}/ 307 | |
/docs/reference/generated/kubernetes-api/latest/* /docs/reference/generated/kubernetes-api/{{ $latest }}/:splat 307 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(a 301 would mean "for now, and forever, you can treat
/docs/reference/generated/kubernetes-api/latest/
as redirecting to
/docs/reference/generated/kubernetes-api/1.34/
- not what we want)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you move this file, make sure that any other guidance makes it clear where to find the legacy / static redirects. People might not figure it out otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @lmktfy
there is currently no guidance referencing the legacy / static redirects but i added comments to explain the new update
685b15f
to
fae0d92
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
LGTM label has been added. Git tree hash: eb9e43139f9897747240cc2bd4c89cd92660cc46
|
Automates generation of /kubernetes-api/latest/ redirects using Hugo
templates that read from hugo.toml's
latest
parameter.Description
Changes:
dependency (the template reads from the stable source file, while
Hugo dynamically generates a new output file on each build)
How it works:
The template reads the version from hugo.toml, generates the dynamic
"latest" redirects, then includes all static redirects from _redirects.base (prev. _redirects).
The final _redirects file is generated on every build.
preview changes:
https://deploy-preview-52591--kubernetes-io-main-staging.netlify.app/docs/reference/generated/kubernetes-api/latest
Issue
Closes: #51542