Repository navigation
Cherry-pick canonical link injection to release/6.4.x - #168
Merged
heckj merged 1 commit intoSep 18, 2026
Merged
Conversation
* Inject canonical link tags into combined-archive HTML stubs Every post-transform-for-static-hosting index.html stub currently carries no page-identifying metadata, so versioned rebuilds of the same content (main, release branches, etc.) have nothing telling search engines which copy is authoritative. Adds an opt-in build_docs.py step, gated by a new --canonical-base-url flag, that stamps a self-describing <link rel="canonical"> into every route's stub, all pointed at the same fixed base URL regardless of which version_slug produced the archive. Addresses swiftlang#135. * Move canonical-link base URL into sources.json config Replaces the --canonical-base-url CLI flag with an optional top-level canonical_base_url field in sources.json, alongside version. Canonical injection is a property of the single combined archive a build produces, not of any one source, so it belongs with the other whole-build config rather than being passed per-invocation. Sets it to https://docs.swift.org/latest on main, per the policy that every version_slug build should declare the same canonical target. * code cleanup and fixing up prior tests * test improvements, consolidation
This was referenced Sep 18, 2026
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
release/6.4.xTest plan
python3 -m unittest test_build_docs— 188 tests passscripts/sources.jsonretains this branch's"version.slug": "latest"while gaining"canonical_base_url": "https://docs.swift.org/latest"