Improve docs SEO/AEO: fix broken canonical URLs, add meta descriptions and llms.txt - #1181
Open
twiecki wants to merge 1 commit into
Open
Improve docs SEO/AEO: fix broken canonical URLs, add meta descriptions and llms.txt#1181twiecki wants to merge 1 commit into
twiecki wants to merge 1 commit into
Conversation
GSC data (2026-08-31) showed 549 pages crawled-but-not-indexed and 0.4-1.4% CTR on top method pages. Fixes: - Remove trailing slash from html_context baseurl, which produced double-slash canonical URLs sitewide via the theme template - Add sphinxext-opengraph for og:* tags and auto meta descriptions - Hand-written meta descriptions for high-impression Markdown pages (homepage, gallery index via gallery.yaml, knowledgebase pages) - Query-matched H1s for the top underperforming notebooks - Add llms.txt for LLM crawlers and SoftwareSourceCode JSON-LD on the landing page Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Documentation build overview
9 files changed ·
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1181 +/- ##
=======================================
Coverage 96.03% 96.03%
=======================================
Files 105 105
Lines 16363 16370 +7
Branches 916 916
=======================================
+ Hits 15714 15721 +7
Misses 485 485
Partials 164 164 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
What & why
Google Search Console (export 2026-08-31) shows the docs site ranks well for high-intent queries but has weak indexing and poor snippet CTR:
https://causalpy.readthedocs.io//en/stable/...). The theme'slayout.htmljoins{{ baseurl }}/{{ language }}/...and ourhtml_context["baseurl"]ended with a trailing slash. (pymc-marketing.io has the same bug — flagged separately.)Changes
Canonical fix (highest impact)
conf.py: remove the trailing slash fromhtml_context["baseurl"]→ canonicals are now valid absolute URLs pointing at/en/stable/, consolidating latest/stable duplication. Longer term this should also be hardened upstream inlabs-sphinx-theme.Meta descriptions + social cards
sphinxext-opengraph: emitsog:*tags sitewide and auto-generates<meta name="description">from the page's opening text for every page that lacks an explicit one.descriptionfield ingallery.yaml, supported bygenerate_gallery.py), estimands, design notation, reporting statistics, written resources. (Note: MyST-NB does not parse front matter inside.ipynbfirst cells — verified locally — so notebooks rely on the auto-description from their opening paragraph; the synthetic control notebook gained a proper intro paragraph for this reason.)Title/H1 tuning for query match (top underperformers only, gallery cards kept in sync)
pymc" → "Inverse Propensity Score Weighting (IPW) in Python"pymcmodels" → "Bayesian Synthetic Control in Python"AEO (answer-engine optimization)
llms.txt(served at/en/<version>/llms.txt): a structured summary of the library with canonical links, for LLM crawlers (ChatGPT, Claude, Perplexity).SoftwareSourceCodeJSON-LD on the landing page via a smalllayout.htmltemplate override.Verified locally
https://causalpy.readthedocs.io/en/stable/...(single slash).llms.txtandrobots.txtcopied to the build root; JSON-LD present on the homepage only.Follow-ups (not in this PR)
/llms.txt→/en/stable/llms.txtso the file also exists at the conventional root path.rediraffeentries.labs-sphinx-theme(normalizebaseurl, and prefer directory-style canonicals for index pages); pymc-marketing needs the same conf.py fix until then.🤖 Generated with Claude Code