Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate social media preview cards for the documentation #132101

Merged
merged 7 commits into from
Apr 5, 2025

Conversation

AA-Turner
Copy link
Member

@AA-Turner AA-Turner commented Apr 4, 2025

Replaces #129120, requires python/docsbuild-scripts#242, closes python/docsbuild-scripts#147.

This generates a Doc/build/html/_images/social_previews/ directory of ~500 .png images (one per page; ~40MB). Per Hugo's comment in GH-129120, it removes HTML from the page head like:

<meta property="og:image" content="https://docs.python.org/3/_static/og-image.png" />
<meta property="og:image:alt" content="Python documentation" />
...
<meta property="og:image:width" content="200" />
<meta property="og:image:height" content="200" />

And adds:

<meta property="og:url" content="https://docs.python.org/3/library/mm.html" />
...
<meta property="og:image:width" content="1146" />
<meta property="og:image:height" content="600" />
<meta property="og:image" content="_images/social_previews/summary_library_mm_8b5ad9c4.png" />
<meta property="og:image:alt" content="The modules described in this chapter implement various algorithms or interfaces that are mainly useful for multimedia applications. They are available at th..." />
...
<meta name="twitter:card" content="summary_large_image" />

A


📚 Documentation preview 📚: https://cpython-previews--132101.org.readthedocs.build/

@AA-Turner AA-Turner added docs Documentation in the Doc dir skip issue skip news labels Apr 4, 2025
@AA-Turner AA-Turner requested a review from hugovk as a code owner April 4, 2025 22:14
@AA-Turner AA-Turner force-pushed the docs/ogp_social_cards branch from 1ef8448 to 9533953 Compare April 4, 2025 22:25
Copy link
Member

@hugovk hugovk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As #129120 (comment), we'll only generate images for the docs server, but here's indicative times, and they're very similar to before.

Read the Docs:

macOS:

  • Without images: 38s
  • With images: 48s

@AA-Turner AA-Turner enabled auto-merge (squash) April 5, 2025 14:15
@AA-Turner AA-Turner merged commit 561965f into python:main Apr 5, 2025
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip issue skip news
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Deploying extra images with docs
2 participants