Skip to content

fix: a README homepage's links to guide pages reach the built pages - #7

Merged
burinc merged 2 commits into
mainfrom
fix/readme-guide-links
Nov 13, 2026
Merged

burinc merged 2 commits into
mainfrom
fix/readme-guide-links

Conversation

@burinc

@burinc burinc commented Nov 13, 2026

Copy link
Copy Markdown
Member

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-links rewrites each href that starts with docs/guide/ or ./docs/guide/ and names a .md file to <site-base>/guide/<path>.html. It handles either quote style, nested paths and a #fragment. The README case of render applies it after the asset rewrite. Links to anything else, such as bench/README.md or 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.

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.
@burinc
burinc merged commit 6b3af84 into main Nov 13, 2026
1 check passed
@burinc
burinc deleted the fix/readme-guide-links branch November 13, 2026 21:39
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.

1 participant