docs: the docs were only readable one page at a time on github.com - #154
Merged
Conversation
Publishes docs/ as a Hugo site at https://skyoo2003.github.io/devcloud/, built from the same files github.com renders rather than a copy of them. Hugo mounts the directory, so docs/*.md gain no front matter and keep the plain relative links that make them readable in the repository. Three theme overrides carry that constraint: - layouts/_markup/render-link.html resolves the 83 links inside docs/ to site URLs and sends the 46 that escape it — ../internal/gateway/router.go, ../CONTRIBUTING.md — to GitHub instead of a 404. - layouts/_partials/docs/title.html reads each page's H1, because the theme's filename fallback renders "Crud Engine", "Faq" and "Iam Sts", and the alternative is a title key on all twenty documents that GitHub shows as a metadata table. - layouts/_partials/docs/menu-filetree.html is empty so the sidebar comes from [menu.before] in hugo.toml, which orders the pages; Hugo would otherwise sort them alphabetically and bury Getting Started at ten. That first hook cannot fail loudly: an unresolvable link is indistinguishable from a legitimate one leaving docs/, so a renamed page would quietly become a GitHub URL that goes nowhere. scripts/check-site-links.py checks the built output instead, and runs in CI on pull requests as well as on main. hugo.toml keeps the deprecated module.mounts.excludeFiles: its replacement does not filter mounts as of Hugo v0.165.0, and without it README.md is built twice — once as the home page, once as /readme/.
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.
Summary
Publishes
docs/as a searchable Hugo site at https://skyoo2003.github.io/devcloud/, built from the same twenty markdown files github.com renders rather than a copy of them.Related Issue
N/A — no tracking issue.
Changes
The constraint that shaped everything:
docs/*.mdare read two ways now, so they gain no front matter and keep their plain relative links. Hugo mounts the directory instead of copying it, anddocs/README.mdbecomes the home page rather than a duplicated_index.md.hugo.toml— mounts, and the sidebar order as[menu.before]. Every entry needs its ownidentifier; entries carrying onlypageRefshare the empty identifier and collapse into one surviving link.layouts/_markup/render-link.html— resolves the 83 links insidedocs/to site URLs and rewrites the 46 that escape it (../internal/gateway/router.go,../CONTRIBUTING.md) to GitHub blob/tree URLs instead of 404s.layouts/_partials/docs/title.html— titles from each page's H1. The theme's filename fallback produces "Crud Engine", "Faq" and "Iam Sts"; the fix it expects is atitlekey on all twenty documents, which github.com renders as a metadata table above every page.layouts/_partials/docs/menu-filetree.html— empty, so the sidebar comes from config. Hugo sorts pages alphabetically withoutweight, which buries Getting Started at position ten.scripts/check-site-links.py— the render hook cannot fail loudly, because an unresolvable link is indistinguishable from a legitimate one leavingdocs/. A renamed page would quietly become a GitHub URL that goes nowhere. This checks the built output instead..github/workflows/pages.yml— builds on pull requests too (the link check is the gate), deploys only frommain. Hugo pinned to 0.165.0; actions pinned by SHA, matchinglint.yml.themes/hugo-bookas a submodule rather than a Hugo module, sohugo mod initnever touches the rootgo.modthat belongs to the Go program.Makefile—docs-serve,docs-build;cleannow also removespublic/andresources/.docs/contributing.md— a Documentation section stating the no-front-matter rule and that a new page needs a[menu.before]entry to appear in the sidebar.Known wart:
hugo.tomlkeeps the deprecatedmodule.mounts.excludeFiles. Its replacementfilesdoes not filter mounts as of Hugo v0.165.0 — six patterns and a mount reorder were all silently ignored — and without itREADME.mdis built twice, as the home page and again as/readme/. The reasoning is recorded at the call site; it costs one deprecation warning per build.Test Plan
make docs-build— 29 pages, 887 internal links all resolve, no errors.public/.../internal/auth/auth.go→blob/main/…,../internal/auth/→tree/main/…,../TRADEMARKS.md→ repository root.BookEditLinkcorrected — it was emittingedit/main/docs/docs/…because.Pathalready arrives prefixed.hugo server):/and/getting-started/both 200; search index (99 KB), mobile nav and colour-scheme toggle present in the output.pre-commit run --all-filespasses.Not yet exercised: the deploy job. GitHub Pages is already set to
build_type: workflowwith no build history, so the first real deployment happens when this merges.Checklist
scripts/check-site-links.py, which CI runs on every pull request; verified it fails when a page goes missinggolangci-linthas nothing to say;pre-commit(ruff, ruff-format, yaml, whitespace) passes