From 71c84fadf4f502cd003bbd34b430aef5dbb260a1 Mon Sep 17 00:00:00 2001
From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Date: Wed, 24 Sep 2025 14:27:40 +0300
Subject: [PATCH] [3.12] GH-136155: Use ``sphinxext-opengraph`` v0.12.0
(GH-137393) (#138741)
(cherry picked from commit 39bd7c3156b00dda85ea09dffdde3e3536f37a55)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
---
Doc/conf.py | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/Doc/conf.py b/Doc/conf.py
index 61c4e7d2b57f..9cb184d07860 100644
--- a/Doc/conf.py
+++ b/Doc/conf.py
@@ -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 = (
- '',
- '',
- '',
-)
+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 += (
+ '',
+ '',
+ )
--
2.47.3