{# The three data-* attributes are all required: @primer/primitives scopes each theme with selectors like [data-color-mode="auto"][data-light-theme="light"] so setting data-color-mode alone leaves every variable undefined. #} {# `i18n_page_locale` is put on the page context by mkdocs-static-i18n. That plugin only rewrites `theme.locale` for the themes it ships support for, so a third-party theme that reads `theme.locale` alone labels every translated page as the default language. #} {%- block site_meta %} {%- set page_title = page.title if page and page.title else config.site_name %} {%- set page_description = page.meta.description if page and page.meta.description else config.site_description %} {%- if page and page.meta.description %} {%- elif config.site_description %} {%- endif %} {%- if config.site_author %} {%- endif %} {%- if page and page.canonical_url %} {%- endif %} {# Social crawlers generally do not infer a page title or description. #} {%- if page_description %} {%- endif %} {%- if page and page.canonical_url %} {%- endif %} {%- if page and page.meta.image %} {%- endif %} {%- if config.theme.favicon %} {%- endif %} {# mkdocs-rss-plugin writes the feeds but leaves discovery to the theme, so without these a reader has no way to find them. The filenames are a plugin option, hence reading them back off the plugin config. #} {%- set rss_plugin = config.plugins.get('rss') %} {%- if rss_plugin %} {%- endif %} {%- endblock %} {% block htmltitle %}{% if page and page.title and not page.is_homepage %}{{ page.title }} - {% endif %}{{ config.site_name }}{% endblock %} {%- block styles %} {# Size/spacing/typography tokens first: Primer consumes them without fallbacks. #} {%- if config.theme.font and config.theme.font.source %} {%- endif %} {%- if config.theme.font and (config.theme.font.text or config.theme.font.code) %} {%- endif %} {%- for path in config.extra_css %} {%- endfor %} {%- endblock %} {# Applies the stored color mode before first paint. Must stay inline and blocking, otherwise a dark-mode visitor gets a flash of the light theme. #} {%- block extrahead %}{% endblock %} {% trans %}Skip to content{% endtrans %} {%- block header %} {% include "partials/header.html" %} {%- endblock %} {# Suppressed in a static template on a translated site: `nav` there is the last locale mkdocs-static-i18n built, so every link would point out of the locale the visitor is actually in. See partials/header.html. #} {%- set show_sidebar = config.theme.include_sidebar and nav and (page or not config.plugins.get('i18n')) %}
{%- block site_nav %} {%- if show_sidebar %} {%- endif %} {%- endblock %}
{# Above the columns rather than beside them, so the trail starts where the page title does and shares the reading column's width. #} {%- block breadcrumbs %} {% include "partials/breadcrumbs.html" %} {%- endblock %}
{# A sibling of the article, not a child of it: on a wide window the stylesheet lifts it into the third column, and where there is no room for one it stays here, above the prose. See partials/toc.html. #} {%- block toc %} {% include "partials/toc.html" %} {%- endblock %} {# tabindex="-1" is what makes the skip link work: without it the browser scrolls but leaves focus at the top of the document, so the next Tab goes straight back into the header the visitor just skipped. #}
{%- block content %} {{ page.content }} {%- endblock %}
{%- block pagination %} {% include "partials/pagination.html" %} {%- endblock %} {%- block footer %} {%- if config.theme.show_footer %} {% include "partials/footer.html" %} {%- endif %} {%- endblock %}
{%- block scripts %} {# Unconditional: the search plugin is not the only consumer. Anything added through `extra_javascript` reads it too — mike's version selector is one — and those scripts have no way to know whether search happens to be enabled. #} {# Strings for the controls the scripts build at runtime. A .js file is served as-is and never passes through Jinja, so it cannot reach the translation catalog itself. #} {# Unconditional: the language and navigation popovers exist with or without search. #} {%- if config.theme.offline %} {%- endif %} {%- for script in config.extra_javascript %} {{ script | script_tag }} {%- endfor %} {%- endblock %}