From abb4a2c9d1ddd813ec464803198cc5cfc4e2d420 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Sat, 7 Jan 2023 18:46:35 +0200 Subject: [PATCH 1/7] Generate social media cards per page --- Doc/conf.py | 19 ++++++++++++------- Doc/requirements.txt | 2 ++ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Doc/conf.py b/Doc/conf.py index 7c7acc8029c732..678729878666ad 100644 --- a/Doc/conf.py +++ b/Doc/conf.py @@ -624,11 +624,16 @@ # Options for sphinxext-opengraph # ------------------------------- -ogp_site_url = 'https://docs.python.org/3/' +ogp_site_url = 'https://hugovk-cpython.readthedocs.io/en/ogp_social_cards/' ogp_site_name = 'Python documentation' -ogp_image = '_static/og-image.png' -ogp_custom_meta_tags = [ - '', - '', - '', -] +# ogp_image = '_static/og-image.png' +# ogp_custom_meta_tags = [ +# '', +# '', +# '', +# ] + +ogp_social_cards = { + "image": "_static/og-image.png", + "line_color": "#3776ab", +} diff --git a/Doc/requirements.txt b/Doc/requirements.txt index 2e429f46b43408..c233423e917d5b 100644 --- a/Doc/requirements.txt +++ b/Doc/requirements.txt @@ -19,3 +19,5 @@ sphinx-notfound-page~=1.0.0 python-docs-theme>=2023.3.1,!=2023.7 -c constraints.txt + +matplotlib From a58e8768418ed74d5ce6efccf483ef1592135c8f Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Mon, 20 Jan 2025 23:02:32 +0000 Subject: [PATCH 2/7] Use the create-social-cards tag --- Doc/conf.py | 25 ++++++++++++++----------- Doc/requirements.txt | 2 -- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Doc/conf.py b/Doc/conf.py index 678729878666ad..5040e1221d6ef6 100644 --- a/Doc/conf.py +++ b/Doc/conf.py @@ -624,16 +624,19 @@ # Options for sphinxext-opengraph # ------------------------------- -ogp_site_url = 'https://hugovk-cpython.readthedocs.io/en/ogp_social_cards/' +ogp_site_url = 'https://docs.python.org/3/' ogp_site_name = 'Python documentation' -# ogp_image = '_static/og-image.png' -# ogp_custom_meta_tags = [ -# '', -# '', -# '', -# ] - -ogp_social_cards = { - "image": "_static/og-image.png", - "line_color": "#3776ab", +ogp_social_cards = { # Used when matplotlib is installed + 'image': '_static/og-image.png', + 'line_color': '#3776ab', } +ogp_custom_meta_tags = [ + '', +] +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 += [ + '', + '', + ] diff --git a/Doc/requirements.txt b/Doc/requirements.txt index c233423e917d5b..2e429f46b43408 100644 --- a/Doc/requirements.txt +++ b/Doc/requirements.txt @@ -19,5 +19,3 @@ sphinx-notfound-page~=1.0.0 python-docs-theme>=2023.3.1,!=2023.7 -c constraints.txt - -matplotlib From a5844c02e1d9403bebea86c74fc16b032f20b1b2 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Mon, 20 Jan 2025 23:48:18 +0000 Subject: [PATCH 3/7] Remove ``social_previews`` folder before archiving --- Doc/Makefile | 1 + 1 file changed, 1 insertion(+) 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) From ed895760e283b54aba7c033f705bbbb3a6950cb3 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Fri, 4 Apr 2025 22:40:39 +0100 Subject: [PATCH 4/7] Use new ogp_canonical_url setting --- Doc/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/conf.py b/Doc/conf.py index 5040e1221d6ef6..cfd8b3a16dc8f7 100644 --- a/Doc/conf.py +++ b/Doc/conf.py @@ -624,7 +624,7 @@ # 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_social_cards = { # Used when matplotlib is installed 'image': '_static/og-image.png', From 32dd018bed0c652e1d59742854c7404abf9f1f58 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Fri, 4 Apr 2025 23:15:45 +0100 Subject: [PATCH 5/7] Require sphinxext-opengraph 0.10 --- Doc/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 9533953594c0280e8e2b7e78112a02fc826ba616 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Fri, 4 Apr 2025 23:21:49 +0100 Subject: [PATCH 6/7] TMP: --tag create-social-cards --- Doc/Makefile | 2 +- Doc/requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/Makefile b/Doc/Makefile index c8a749a02a89ec..953120a9f6e546 100644 --- a/Doc/Makefile +++ b/Doc/Makefile @@ -73,7 +73,7 @@ build: echo ""; \ exit 1; \ fi - $(SPHINXBUILD) $(ALLSPHINXOPTS) + $(SPHINXBUILD) $(ALLSPHINXOPTS) --tag create-social-cards @echo .PHONY: html diff --git a/Doc/requirements.txt b/Doc/requirements.txt index a2960ea9aa0203..e4a12dcbdd0658 100644 --- a/Doc/requirements.txt +++ b/Doc/requirements.txt @@ -11,7 +11,7 @@ sphinx~=8.2.0 blurb -sphinxext-opengraph~=0.10.0 +sphinxext-opengraph[social-cards]~=0.10.0 sphinx-notfound-page~=1.0.0 # The theme used by the documentation is stored separately, so we need From c35a83330e634c06e5db1bdb7a5b585a6d6d5571 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Sat, 5 Apr 2025 15:14:15 +0100 Subject: [PATCH 7/7] Revert "TMP: --tag create-social-cards" This reverts commit 9533953594c0280e8e2b7e78112a02fc826ba616. --- Doc/Makefile | 2 +- Doc/requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/Makefile b/Doc/Makefile index 953120a9f6e546..c8a749a02a89ec 100644 --- a/Doc/Makefile +++ b/Doc/Makefile @@ -73,7 +73,7 @@ build: echo ""; \ exit 1; \ fi - $(SPHINXBUILD) $(ALLSPHINXOPTS) --tag create-social-cards + $(SPHINXBUILD) $(ALLSPHINXOPTS) @echo .PHONY: html diff --git a/Doc/requirements.txt b/Doc/requirements.txt index e4a12dcbdd0658..a2960ea9aa0203 100644 --- a/Doc/requirements.txt +++ b/Doc/requirements.txt @@ -11,7 +11,7 @@ sphinx~=8.2.0 blurb -sphinxext-opengraph[social-cards]~=0.10.0 +sphinxext-opengraph~=0.10.0 sphinx-notfound-page~=1.0.0 # The theme used by the documentation is stored separately, so we need