{# "On this page" for the current document. MkDocs hands the heading tree to the theme as `page.toc` and nothing else surfaces it, so without this a long page offers no way to see its sections or jump between them. python-markdown nests the whole document under its single h1, which is already the page title on screen; descend past it when that is the shape, so the list starts at the h2 level. #} {%- if page and page.toc %} {%- set entries = page.toc | list %} {%- if entries | length == 1 and entries[0].children %} {%- set entries = entries[0].children | list %} {%- endif %} {# One entry is the page itself; there is nothing to navigate between. #} {%- if entries | length > 1 %}
{% trans %}On this page{% endtrans %}
{# The block reads as part of the page, so it belongs under the title — but the title comes from the Markdown, inside page.content, where a template cannot reach. Moving it is cosmetic: with no JavaScript it stays above the article and works exactly the same. #} {%- endif %} {%- endif %}