diff --git a/Doc/tools/templates/layout.html b/Doc/tools/templates/layout.html
index c3992245614..8cf903dec6e 100644
--- a/Doc/tools/templates/layout.html
+++ b/Doc/tools/templates/layout.html
@@ -1,27 +1,106 @@
{% extends "!layout.html" %}
-
{% block rootrellink %}
-{{ super() }}
-
- {%- if switchers is defined %}
- {{ language or 'en' }}
- {{ release }}
- {% trans %}Documentation {% endtrans %}{{ reldelim1 }}
- {%- else %}
- {{ shorttitle }}{{ reldelim1 }}
- {%- endif %}
-
+
+ Python{{ reldelim1 }}
+
+ {%- if switchers is defined %}
+ {{ language or 'en' }}
+ {{ release }}
+ {% trans %}Documentation {% endtrans %}{{ reldelim1 }}
+ {%- else %}
+ {{ shorttitle }}{{ reldelim1 }}
+ {%- endif %}
+
+{% endblock %}
+{%- macro searchbox() %}
+{# modified from sphinx/themes/basic/searchbox.html #}
+ {%- if builder != "htmlhelp" %}
+
+
+
+
+ {%- endif %}
+{%- endmacro %}
+{% block relbar1 %} {% if builder != 'qthelp' %} {{ relbar() }} {% endif %} {% endblock %}
+{% block relbar2 %} {% if builder != 'qthelp' %} {{ relbar() }} {% endif %} {% endblock %}
+{% block relbaritems %}
+ {%- if pagename != "search" and builder != "singlehtml" and builder != "htmlhelp" %}
+
+ {{ searchbox() }}
+ {{ reldelim2 }}
+
+ {%- endif %}
{% endblock %}
-
{% block extrahead %}
+
{% if builder != "htmlhelp" %}
- {% if switchers is defined and not embedded %}
- {% endif %}
- {% if pagename == 'whatsnew/changelog' and not embedded %}
- {% endif %}
- {% endif %}
+ {% if not embedded %}{% endif %}
+ {% if switchers is defined and not embedded %}{% endif %}
+ {% if pagename == 'whatsnew/changelog' and not embedded %}
+
+ {% endif %}
+ {% endif %}
{# custom CSS; used in asyncio docs! #}
{{ super() }}
{% endblock %}
+{% block footer %}
+
+{% endblock %}