Doc: Add an optional obsolete header. (GH-13638)

diff --git a/Doc/README.rst b/Doc/README.rst
index 31f8a8b..380ea4f 100644
--- a/Doc/README.rst
+++ b/Doc/README.rst
@@ -113,6 +113,15 @@
 where ``<builder>`` is one of html, text, latex, or htmlhelp (for explanations
 see the make targets above).
 
+Deprecation header
+==================
+
+You can define the ``outdated`` variable in ``html_context`` to show a
+red banner on each page redirecting to the "latest" version.
+
+The link points to the same page on ``/3/``, sadly for the moment the
+language is lost during the process.
+
 
 Contributing
 ============
diff --git a/Doc/tools/templates/layout.html b/Doc/tools/templates/layout.html
index c399224..a765a5d 100644
--- a/Doc/tools/templates/layout.html
+++ b/Doc/tools/templates/layout.html
@@ -1,5 +1,15 @@
 {% extends "!layout.html" %}
 
+{% block header %}
+{%- if outdated %}
+<div id="outdated-warning" style="padding: .5em; text-align: center; background-color: #FFBABA; color: #6A0E0E;">
+    {% trans %}This document is for an old version of Python that is no longer supported.
+    You should upgrade, and read the {% endtrans %}
+    <a href="/3/{{ pagename }}{{ file_suffix }}">{% trans %} Python documentation for the last stable release {% endtrans %}</a>.
+</div>
+{%- endif %}
+{% endblock %}
+
 {% block rootrellink %}
 {{ super() }}
     <li>