]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] GH-136155: Use ``sphinxext-opengraph`` v0.12.0 (GH-137393) (#138741)
authorHugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Wed, 24 Sep 2025 11:27:40 +0000 (14:27 +0300)
committerGitHub <noreply@github.com>
Wed, 24 Sep 2025 11:27:40 +0000 (12:27 +0100)
(cherry picked from commit 39bd7c3156b00dda85ea09dffdde3e3536f37a55)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Doc/conf.py

index 61c4e7d2b57fc80b3f88f90d1fd7b2eddf5c5264..9cb184d0786029afeb0e80cae5c7f8f43051d95d 100644 (file)
@@ -598,11 +598,17 @@ stable_abi_file = 'data/stable_abi.dat'
 # 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_custom_meta_tags = (
-    '<meta property="og:image:width" content="200">',
-    '<meta property="og:image:height" content="200">',
-    '<meta name="theme-color" content="#3776ab">',
-)
+ogp_social_cards = {  # Used when matplotlib is installed
+    'image': '_static/og-image.png',
+    'line_color': '#3776ab',
+}
+ogp_custom_meta_tags = ('<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">',
+    )