diff options
author | Ashwin Ramaswami <aramaswamis@gmail.com> | 2022-12-06 13:37:41 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-06 13:37:41 (GMT) |
commit | 85d5a7e8ef472a4a64e5de883cf313c111a8ec77 (patch) | |
tree | d15d52be482f4fea1c47a9c9d28561074ac7b6a7 /Doc | |
parent | 5837e5f3478a6f3afb64502edc757f312c2db507 (diff) | |
download | cpython-85d5a7e8ef472a4a64e5de883cf313c111a8ec77.zip cpython-85d5a7e8ef472a4a64e5de883cf313c111a8ec77.tar.gz cpython-85d5a7e8ef472a4a64e5de883cf313c111a8ec77.tar.bz2 |
bpo-37860: re-add netlify.toml to set up deploy previews for docs (#92852)
* Revert "bpo-46184: remove `netlify.toml` (#30272)"
This reverts commit fbaf2e604cd354f1ebc6be029480010c6715a8ca.
* Delete runtime.txt
* Create runtime.txt
* Delete runtime.txt
* Update netlify.toml
* Update netlify.toml
* Add netlify badge
* Update Doc/tools/templates/layout.html
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
* Update layout.html
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/conf.py | 8 | ||||
-rw-r--r-- | Doc/tools/templates/layout.html | 13 |
2 files changed, 21 insertions, 0 deletions
diff --git a/Doc/conf.py b/Doc/conf.py index c7d2f43..b3da8fa 100644 --- a/Doc/conf.py +++ b/Doc/conf.py @@ -105,6 +105,14 @@ if any('htmlhelp' in arg for arg in sys.argv): # Short title used e.g. for <title> HTML tags. html_short_title = '%s Documentation' % release +# Deployment preview information, from Netlify +# (See netlify.toml and https://docs.netlify.com/configure-builds/environment-variables/#git-metadata) +html_context = { + "is_deployment_preview": os.getenv("IS_DEPLOYMENT_PREVIEW"), + "repository_url": os.getenv("REPOSITORY_URL"), + "pr_id": os.getenv("REVIEW_ID") +} + # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. html_last_updated_fmt = '%b %d, %Y' diff --git a/Doc/tools/templates/layout.html b/Doc/tools/templates/layout.html index 98ccf42..460161c 100644 --- a/Doc/tools/templates/layout.html +++ b/Doc/tools/templates/layout.html @@ -8,6 +8,19 @@ <a href="/3/{{ pagename }}{{ file_suffix }}">{% trans %} Python documentation for the current stable release{% endtrans %}</a>. </div> {%- endif %} + +{%- if is_deployment_preview %} +<div id="deployment-preview-warning" style="padding: .5em; text-align: center; background-color: #fff2ba; color: #6a580e;"> + <div style="float: right; margin-top: -10px; margin-left: 10px;"> + <a href="https://www.netlify.com"> + <img src="https://www.netlify.com/img/global/badges/netlify-color-accent.svg" alt="Deploys by Netlify" /> + </a> + </div> + {% trans %}This is a deploy preview created from a <a href="{{ repository_url }}/pull/{{ pr_id }}">pull request</a>. + For authoritative documentation, see the {% endtrans %} + <a href="https://docs.python.org/3/{{ pagename }}{{ file_suffix }}">{% trans %} the current stable release{% endtrans %}</a>. +</div> +{%- endif %} {% endblock %} {% block rootrellink %} |