build_site.py: publish each page at its own repo path, not under labs/labs/ - #38
Merged
Merged
Conversation
…/labs/ The builder prefixed a literal `labs/` to a path that already starts with `labs/` for anything under labs/, so every lab page was one directory deeper than its docstring claimed: /labs/labs/elastic-migration/index.html 200 /labs/elastic-migration/index.html 404 The site was internally consistent -- the index linked the doubled path and it resolved -- so nothing was broken and every URL was one segment uglier than intended. The prefix was a namespace, which is why workshops/ escaped it (/labs/workshops/...) while labs/ collided with it. Dropping the namespace makes a page's URL mirror its repo path exactly, which is the property the docstring described and the one worth having: /labs/..., /workshops/..., /otel-profiles/..., /clickstack-config/. Done now rather than later because the site went up today and nothing links to it yet. Once a URL has been given to anyone outside this repository, changing it means keeping a redirect for the old shape. Also fixes the page depth that fed the asset and crumb paths (a page is now exactly as deep as its repo path), the prev/next pager, the index links, the MOVED.md redirect targets and the sitemap -- all of which had the prefix hardcoded separately. Verified by building the site and resolving every relative href and src against the filesystem: 43 relative links across 7 pages, none broken. Closes #37 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Closes #37.
Every lab page was published one directory deeper than the builder's own docstring claimed:
The
labs/prefix was a namespace applied to every page, soworkshops/escaped it(
/labs/workshops/...) while anything underlabs/collided with it. Nothing was broken —the index linked the doubled path and it resolved — every URL was just one segment uglier
than intended.
Dropping the namespace makes each URL mirror its repo path exactly, which is the property
the docstring described:
labs/elastic-migration/labs/labs/elastic-migration//labs/elastic-migration/workshops/o11y-vector-ai/labs/workshops/o11y-vector-ai//workshops/o11y-vector-ai/otel-profiles/labs/otel-profiles//otel-profiles/Done now rather than later because the site went up today and nothing links to it yet.
Once a URL has been given to anyone outside this repository, changing it means keeping a
redirect for the old shape — and
write_redirect()already exists for exactly that kind ofdebt.
The prefix was hardcoded in six places that each had to move together: the page's depth
(which feeds the asset and breadcrumb paths), the prev/next pager, the index links, the
index-table link rewriter, the
MOVED.mdredirect targets and the sitemap.Verified
Built the site and resolved every relative
hrefandsrcagainst the filesystem: 43relative links across 7 pages, none broken. Sitemap now lists
/labs/elastic-migration/,/workshops/…,/otel-profiles/,/clickstack-config/.The old
/labs/labs/…URLs will 404 after this deploys, which is the point of doing itbefore anyone has them.
🤖 Generated with Claude Code