Skip to content

Trailing-slash canonicals on all pages + custom trailing-slash sitemap#430

Merged
Dgiordano33 merged 4 commits into
mainfrom
docs/trailing-slash-canonical-sitemap
Jul 8, 2026
Merged

Trailing-slash canonicals on all pages + custom trailing-slash sitemap#430
Dgiordano33 merged 4 commits into
mainfrom
docs/trailing-slash-canonical-sitemap

Conversation

@Dgiordano33

Copy link
Copy Markdown
Collaborator

Make every SEO signal agree on the trailing slash

The docs serve and Google indexes the trailing-slash form (…/foo/), but Mintlify normalizes internal links and the auto-generated canonical/sitemap to no-slash. Rather than fight that (which would mean a URL migration or a marketing-proxy change), this pins the two signals we can control — canonicals and the sitemap — to the trailing-slash form. All three now agree.

Note: the internal-link 308s remain (Mintlify strips slashes on render — not fixable in source, confirmed earlier). Those are harmless permanent redirects; this PR removes the canonical mismatch, which is the part that actually affects indexing.

1. Per-page trailing-slash canonical on all 569 pages

2. Custom sitemap.xml (trailing slashes)

  • sitemap.xml at the repo root overrides Mintlify's auto-generated sitemap (supported feature). 569 URLs, all trailing-slash — an exact mirror of the auto-gen URL set (verified 1:1).
  • scripts/generate-sitemap.mjs (npm run generate-sitemap) regenerates it from docs.json navigation, so it's not a stale hand-edited file.
  • CI guard: static-docs-checks regenerates on any docs change and fails the PR if sitemap.xml drifts from docs.json — so it can't silently go out of sync.
  • lastmod intentionally omitted (optional; including git dates would churn the file — and CI — on every content edit).

Verified

  • mint broken-links: clean.
  • sitemap.xml: valid XML, 569 trailing-slash <loc>, matches Mintlify's URL set exactly.
  • docs.json untouched (the global seo.metatags.canonical stays as a no-slash fallback for any future page added without its own canonical).

After merge

Spot-check on prod: any page's <link rel="canonical"> ends in /, and www.checklyhq.com/docs-sitemap.xml serves the trailing-slash list. Then let Google re-crawl; the Ahrefs canonical/duplicate flags should clear.

Follow-up (optional, not in this PR)

New nav pages should get their own canonical: (else they fall back to the no-slash global). Easy to add a CI check that every nav page declares one — say the word and I'll add it.

🤖 Generated with Claude Code

Dgiordano33 and others added 3 commits July 8, 2026 11:25
Add a per-page `canonical:` (the page's own www + /docs + trailing-slash
URL) to every page in the docs.json navigation. Mintlify normalizes
internal links and the auto-generated canonical to no-slash, but the site
serves — and Google indexes — the trailing-slash form. Declaring an
explicit trailing-slash canonical makes each page self-referential and
removes the canonical-to-redirect mismatch Ahrefs flagged.

549 pages here; the other 20 (top pages) already carry it from #422.
Generated deterministically from docs.json nav.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Mintlify's auto-generated sitemap lists no-slash URLs, which contradicts
the trailing-slash canonicals and served URLs. Add a custom sitemap.xml
at the repo root (Mintlify serves it in place of the auto-generated one)
listing all 569 nav pages with trailing slashes.

- scripts/generate-sitemap.mjs regenerates it from docs.json navigation
  (npm run generate-sitemap), so it's not a stale snapshot.
- static-docs-checks CI regenerates and fails the PR if sitemap.xml drifts
  from docs.json, so it stays in sync.
- scripts/** added to .mintignore.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Dgiordano33 Dgiordano33 merged commit 6759ff8 into main Jul 8, 2026
5 of 6 checks passed
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