-
Notifications
You must be signed in to change notification settings - Fork 569
docs: Use relative links to site pages #3657
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
docs: Use relative links to site pages #3657
Conversation
This commit modifies the documentation to use relative links between pages on the site instead of absolute URLs. Linking to a page's relative file path allows MKDocs to ensure that page exists and/or linked heading actually exists when building the site. The URLs in the generated HTML files will be relative or absolute, depending on the location of the linked file relative to a given page.
Hi @blake. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
This is awesome, thanks for the work on this! Very cool to see the script behind this. /ok-to-test |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: blake, robscott The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
No meaningful changes to GEPs, just fixing links. Removing the auto-hold. /hold cancel |
What type of PR is this?
/kind documentation
Background:
Currently when running
mkdocs build
ormkdocs serve
, a flood of informational – and some warnings – are logged to the CLI. For example,This is because MkDocs recommends that relative paths be used when linking to pages instead of absolute URLs. Linking to relative paths allows MkDocs to identify and warn about broken links to non-existent pages and headings when it is building the site. MkDocs even has this warning about using absolute URLs.
Warning
Using absolute paths with links is not officially supported. Relative paths are adjusted by MkDocs to ensure they are always relative to the page. Absolute paths are not modified at all. This means that your links using absolute paths might work fine in your local environment but they might break once you deploy them to your production server.
A number of PRs have recently been submitted to this project to resolve several broken links or issues where links were not being properly rendered.
Theoretically these issues could've been identified earlier if MkDocs's validation rules were configured to warn upon finding broken links, and
strict
was enabled.What this PR does / why we need it:
This commit modifies the documentation to use relative links between pages on the site instead of absolute URLs in order to quell the messages in the logs, and set up the site for potentially using
strict
mode in the future.This is a large PR with changes across many files. In order to ensure that the all links were correctly updated and nothing was fat fingered, I wrote a small GNU Awk (gawk) script to assist with modifying the Markdown files. https://gist.github.com/blake/78b166792cd262b6897b784a2dedccfa.
The changes were validated by comparing HTML output of the site when generated from the main branch to the output generated after the Markdown files had been modified by the aforementioned script. For example:
The diff is rather large, but much like the diff for this PR, it primarily consists of the generated URLs changing from absolute to relative.
Its important to note that this PR is strictly focused on rewriting internal URLs to align with the format recommended by MkDocs so that broken links and anchors can be easily detected. It is not intended to fix all of the existing broken URLs or broken anchors. Those will be addressed in a subsequent PR.
Which issue(s) this PR fixes:
Does this PR introduce a user-facing change?: