Skip to content

Commit

Permalink
fix: override correct tag
Browse files Browse the repository at this point in the history
When the template was made responsive, the choice was made to override
the `body_tag` fragment.
The `body_tag` block is a literal `<body>` which allows the theme developer
to set properties on the `body` tag.
See: sphinx-doc/sphinx#4140

Instead, use the `document` block as documented.
https://www.sphinx-doc.org/en/master/development/templating.html#blocks

Overriding the correct block places the `mobile-nav` section _after_ the
majority of the other HTML parts, which enables the correct function of
the `/` keyboard shortcut.

Resolves python#130
Closes python#131
Closes python#135

Signed-off-by: Mike Fiedler <miketheman@gmail.com>
  • Loading branch information
miketheman committed Jul 27, 2023
1 parent 44e62dd commit 788fee7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion python_docs_theme/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ <h3>{{ _('Navigation') }}</h3>
{{ super() }}
{%- endblock -%}

{%- block body_tag %}
{%- block document %}
{{ super() }}
{%- if builder != 'htmlhelp' %}
<div class="mobile-nav">
Expand Down

0 comments on commit 788fee7

Please sign in to comment.