https://github.com/python/cpython/commit/f24f2418021ae178df177eebe8a7b1b35ad1654e commit: f24f2418021ae178df177eebe8a7b1b35ad1654e branch: 3.13 author: Adam Turner <9087854+aa-tur...@users.noreply.github.com> committer: AA-Turner <9087854+aa-tur...@users.noreply.github.com> date: 2025-04-10T06:39:46+01:00 summary:
[3.13] Generate social media preview cards for the documentation (GH-132101) (#132344) files: M Doc/Makefile M Doc/conf.py M Doc/requirements.txt diff --git a/Doc/Makefile b/Doc/Makefile index b8896da4a91869..c8a749a02a89ec 100644 --- a/Doc/Makefile +++ b/Doc/Makefile @@ -204,6 +204,7 @@ dist-html: find dist -name 'python-$(DISTVERSION)-docs-html*' -exec rm -rf {} \; $(MAKE) html cp -pPR build/html dist/python-$(DISTVERSION)-docs-html + rm -rf dist/python-$(DISTVERSION)-docs-html/_images/social_previews/ tar -C dist -cf dist/python-$(DISTVERSION)-docs-html.tar python-$(DISTVERSION)-docs-html bzip2 -9 -k dist/python-$(DISTVERSION)-docs-html.tar (cd dist; zip -q -r -9 python-$(DISTVERSION)-docs-html.zip python-$(DISTVERSION)-docs-html) diff --git a/Doc/conf.py b/Doc/conf.py index c73a4d09617f79..022553b5ff5580 100644 --- a/Doc/conf.py +++ b/Doc/conf.py @@ -616,11 +616,19 @@ # Options for sphinxext-opengraph # ------------------------------- -ogp_site_url = 'https://docs.python.org/3/' +ogp_canonical_url = 'https://docs.python.org/3/' ogp_site_name = 'Python documentation' -ogp_image = '_static/og-image.png' +ogp_social_cards = { # Used when matplotlib is installed + 'image': '_static/og-image.png', + 'line_color': '#3776ab', +} ogp_custom_meta_tags = [ - '<meta property="og:image:width" content="200">', - '<meta property="og:image:height" content="200">', '<meta name="theme-color" content="#3776ab">', ] +if 'create-social-cards' not in tags: # noqa: F821 + # Define a static preview image when not creating social cards + ogp_image = '_static/og-image.png' + ogp_custom_meta_tags += [ + '<meta property="og:image:width" content="200">', + '<meta property="og:image:height" content="200">', + ] diff --git a/Doc/requirements.txt b/Doc/requirements.txt index 2e429f46b43408..a2960ea9aa0203 100644 --- a/Doc/requirements.txt +++ b/Doc/requirements.txt @@ -11,7 +11,7 @@ sphinx~=8.2.0 blurb -sphinxext-opengraph~=0.9.0 +sphinxext-opengraph~=0.10.0 sphinx-notfound-page~=1.0.0 # The theme used by the documentation is stored separately, so we need _______________________________________________ Python-checkins mailing list -- python-checkins@python.org To unsubscribe send an email to python-checkins-le...@python.org https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: arch...@mail-archive.com