Skip to content

doc: add Open Graph meta tags for link previews - #694

Merged
xdelaruelle merged 1 commit into
envmodules:mainfrom
xdelaruelle:opengraph-preview
Aug 29, 2026
Merged

doc: add Open Graph meta tags for link previews#694
xdelaruelle merged 1 commit into
envmodules:mainfrom
xdelaruelle:opengraph-preview

Conversation

@xdelaruelle

Copy link
Copy Markdown
Collaborator

Links to the documentation shared on social media platforms currently render without a preview card, as the generated HTML pages carry no Open Graph metadata. Enable the sphinxext-opengraph extension to produce these meta tags on every page, and point the Open Graph image tag to a new PNG rendering of the project logo (1200x630 pixels, as SVG images are not supported by social media platforms). The twitter:card tag requests the large preview card layout on X/Twitter; Bluesky, Mastodon and LinkedIn build their preview cards from the standard Open Graph tags.

On Read The Docs, page and image URLs are resolved against the canonical URL of the exact documentation version being built (through the READTHEDOCS_CANONICAL_URL environment variable), so every published version gets correct metadata. A fallback site URL pointing to the latest version is used for builds outside of Read The Docs.

The extension is added to the Read The Docs build requirements and is skipped when unavailable, so local documentation builds keep working without it.

Links to the documentation shared on social media platforms render
without a preview card, as generated HTML pages carry no Open Graph
metadata. Enable the sphinxext-opengraph extension to produce these
meta tags on every page. Point the Open Graph image tag to a new PNG
rendering of the project logo, sized 1200 by 630 pixels, since SVG
images are not supported by social media platforms, and request the
large preview card layout on X/Twitter.

On Read The Docs, page and image URLs are resolved against the
canonical URL of the exact documentation version being built, so every
published version gets correct metadata. A fallback site URL pointing
to the latest version is used for builds outside of Read The Docs.

The extension is added to the Read The Docs build requirements and is
skipped when unavailable, so local documentation builds keep working
without it.

Assisted-by: Claude:claude-fable-5
Signed-off-by: Xavier Delaruelle <xavier.delaruelle@cea.fr>
@xdelaruelle
xdelaruelle merged commit 19b4c2b into envmodules:main Aug 29, 2026
20 checks passed
@xdelaruelle
xdelaruelle deleted the opengraph-preview branch August 29, 2026 08:18
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