From 6be3901ca8323585b1231b94dc4f866ed7b0ae98 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Sat, 5 Apr 2025 16:25:13 +0100 Subject: [PATCH 1/2] Define ``ogp_site_url`` for social media cards --- build_docs.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/build_docs.py b/build_docs.py index 7da3520..5711fb1 100755 --- a/build_docs.py +++ b/build_docs.py @@ -751,9 +751,15 @@ def build(self): blurb = self.venv / "bin" / "blurb" if self.includes_html: + site_url = self.version.url + if self.language.tag != "en": + site_url += f"{self.language.tag}/" # Define a tag to enable opengraph socialcards previews # (used in Doc/conf.py and requires matplotlib) - sphinxopts.append("-t create-social-cards") + sphinxopts.extend(( + "-t create-social-cards", + f"-D ogp_site_url={site_url}", + )) # Disable CPython switchers, we handle them now: run( From 0b6289e1cc00981f5cb6d9cc5cdb65973b445810 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Sat, 5 Apr 2025 16:27:11 +0100 Subject: [PATCH 2/2] lint --- build_docs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build_docs.py b/build_docs.py index 5711fb1..23fd6c0 100755 --- a/build_docs.py +++ b/build_docs.py @@ -756,10 +756,10 @@ def build(self): site_url += f"{self.language.tag}/" # Define a tag to enable opengraph socialcards previews # (used in Doc/conf.py and requires matplotlib) - sphinxopts.extend(( + sphinxopts += ( "-t create-social-cards", f"-D ogp_site_url={site_url}", - )) + ) # Disable CPython switchers, we handle them now: run(