{# 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 %} Skip to content {%- block header %} {% include "partials/header.html" %} {%- endblock %}
{%- block site_nav %} {%- if config.theme.include_sidebar and nav %} {%- endif %} {%- endblock %}
{%- 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. #} {%- if 'search' in config.plugins %} {%- endif %} {%- if config.theme.offline %} {%- endif %} {%- for script in config.extra_javascript %} {{ script | script_tag }} {%- endfor %} {%- endblock %}