Skip to content

Cherry-pick canonical link injection to release/6.4.x - #168

Merged
heckj merged 1 commit into
swiftlang:release/6.4.xfrom
heckj:canonical-link-injection-6.4.x
Sep 18, 2026
Merged

heckj merged 1 commit into
swiftlang:release/6.4.xfrom
heckj:canonical-link-injection-6.4.x

Conversation

@heckj

@heckj heckj commented Sep 18, 2026 •

Copy link
Copy Markdown
Member

Summary

Test plan

  • python3 -m unittest test_build_docs — 188 tests pass
  • Confirmed scripts/sources.json retains this branch's "version.slug": "latest" while gaining "canonical_base_url": "https://docs.swift.org/latest"

* 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
@heckj heckj self-assigned this Sep 18, 2026
@heckj
heckj merged commit 447b43d into swiftlang:release/6.4.x Sep 18, 2026
12 checks passed
@heckj
heckj deleted the canonical-link-injection-6.4.x branch September 18, 2026 16:08
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