# 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'
<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 %}