Repository navigation
fix: a README homepage's links to guide pages reach the built pages - #7
Merged
Merged
Conversation
A README links to its guide as docs/guide/x.md, which is right on GitHub. The site writes that page to <site-base>/guide/x.html, and the homepage rendered from the README kept the link as written, so each one was a 404. The homepage now rewrites them, with or without ./, in either quote style, keeping a fragment. Links to anything else are left alone.
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.
On a site whose homepage is rendered from
README.md, every link from the homepage to a guide page was a 404.Why
A README links to its guide as
docs/guide/x.md, relative to the repository root, which is what GitHub needs. The build writes that page to<site-base>/guide/x.html. The homepage kept the link as written, so the browser asked for<site-base>/docs/guide/x.md. v0.4.4 fixed the same thing for images under:asset-dirs, and guide links were left out.Seen on champaca's site, where all 29 guide links on the homepage were dead while the guide pages themselves were fine.
What changed
site.generic-home/rewrite-readme-guide-linksrewrites eachhrefthat starts withdocs/guide/or./docs/guide/and names a.mdfile to<site-base>/guide/<path>.html. It handles either quote style, nested paths and a#fragment. The README case ofrenderapplies it after the asset rewrite. Links to anything else, such asbench/README.mdor an absolute URL, are left as they were.Tests
A new test builds a fixture site from a README with plain,
./, fragment, nested and raw-HTML guide links, plus two links that must not change.bb test: 111 tests, 293 assertions, 0 failures.Checked on champaca: built its site with this branch, and all 29 guide links on the homepage resolve to files in
_site.