|
13 | 13 | # General configuration |
14 | 14 | # --------------------- |
15 | 15 |
|
16 | | -extensions = ['sphinx.ext.coverage', 'sphinx.ext.doctest', |
17 | | - 'pyspecific', 'c_annotations', 'escape4chm', |
18 | | - 'asdl_highlight', 'peg_highlight', 'glossary_search'] |
| 16 | +extensions = [ |
| 17 | + 'asdl_highlight', |
| 18 | + 'c_annotations', |
| 19 | + 'escape4chm', |
| 20 | + 'glossary_search', |
| 21 | + 'peg_highlight', |
| 22 | + 'pyspecific', |
| 23 | + 'sphinx.ext.coverage', |
| 24 | + 'sphinx.ext.doctest', |
| 25 | +] |
| 26 | + |
| 27 | +# Skip if downstream redistributors haven't installed it |
| 28 | +try: |
| 29 | + import sphinxext.opengraph |
| 30 | +except ImportError: |
| 31 | + pass |
| 32 | +else: |
| 33 | + extensions.append('sphinxext.opengraph') |
| 34 | + |
19 | 35 |
|
20 | 36 | doctest_global_setup = ''' |
21 | 37 | try: |
|
89 | 105 | # Short title used e.g. for <title> HTML tags. |
90 | 106 | html_short_title = '%s Documentation' % release |
91 | 107 |
|
| 108 | +# Deployment preview information, from Netlify |
| 109 | +# (See netlify.toml and https://docs.netlify.com/configure-builds/environment-variables/#git-metadata) |
| 110 | +html_context = { |
| 111 | + "is_deployment_preview": os.getenv("IS_DEPLOYMENT_PREVIEW"), |
| 112 | + "repository_url": os.getenv("REPOSITORY_URL"), |
| 113 | + "pr_id": os.getenv("REVIEW_ID") |
| 114 | +} |
| 115 | + |
92 | 116 | # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, |
93 | 117 | # using the given strftime format. |
94 | 118 | html_last_updated_fmt = '%b %d, %Y' |
|
114 | 138 | html_use_opensearch = 'https://docs.python.org/' + version |
115 | 139 |
|
116 | 140 | # Additional static files. |
117 | | -html_static_path = ['tools/static'] |
| 141 | +html_static_path = ['_static', 'tools/static'] |
118 | 142 |
|
119 | 143 | # Output file base name for HTML help builder. |
120 | 144 | htmlhelp_basename = 'python' + release.replace('.', '') |
|
238 | 262 | # Relative filename of the data files |
239 | 263 | refcount_file = 'data/refcounts.dat' |
240 | 264 | stable_abi_file = 'data/stable_abi.dat' |
| 265 | + |
| 266 | +# sphinxext-opengraph config |
| 267 | +ogp_site_url = 'https://docs.python.org/3/' |
| 268 | +ogp_site_name = 'Python documentation' |
| 269 | +ogp_image = '_static/og-image.png' |
| 270 | +ogp_custom_meta_tags = [ |
| 271 | + '<meta property="og:image:width" content="200">', |
| 272 | + '<meta property="og:image:height" content="200">', |
| 273 | + '<meta name="theme-color" content="#3776ab">', |
| 274 | +] |
0 commit comments