Add meta tags using an Open Graph extension

This commit is contained in:
Laurence Isla
2023-12-07 15:52:57 -05:00
committed by GitHub
parent f80a33cf32
commit d24a3c82ef
5 changed files with 19 additions and 70 deletions
+14 -1
View File
@@ -30,7 +30,8 @@ import os
# ones.
extensions = [
'sphinx_tabs.tabs',
'sphinx_copybutton'
'sphinx_copybutton',
'sphinxext.opengraph',
]
# Add any paths that contain templates here, relative to this directory.
@@ -298,3 +299,15 @@ user_agent = 'Mozilla/5.0 (X11; Linux x86_64; rv:25.0) Gecko/20100101 Firefox/25
# sphinx-tabs configuration
sphinx_tabs_disable_tab_closing = True
# sphinxext-opengraph configuration
ogp_image = '_images/logo.png'
ogp_use_first_image = True
ogp_enable_meta_description = True
ogp_description_length = 300
## RTD sets html_baseurl, ensures we use the correct env for canonical URLs
## Useful to generate correct meta tags for Open Graph
## Refs: https://github.com/readthedocs/readthedocs.org/issues/10226, https://github.com/urllib3/urllib3/pull/3064
html_baseurl = os.environ.get("READTHEDOCS_CANONICAL_URL", "/")