{#- `t`, `icon` and the other helpers come from the `sumi` plugin: without it, stop with a clear message. -#} {%- if t is not defined %}{% include "The Sumi theme needs its plugin: add `- sumi` under `plugins:` in mkdocs.yml" %}{% endif -%} {%- import "partials/macros.html" as m with context -%} {%- set sumi = sumi if sumi is defined else {} -%} {%- set theme = config.theme -%} {%- set hide = (page.meta.hide if page and page.meta and page.meta.hide else []) + (theme.hide or []) -%} {%- set layout = page.meta.layout if page and page.meta and page.meta.layout else 'docs' -%} {%- set has_sections = nav.items | selectattr('is_section') | list | length > 0 -%} {#- `navigation_tabs: always` shows top-level items as tabs even when the nav has no sections. -#} {%- set tabs_on = (theme.navigation_tabs and has_sections) or theme.navigation_tabs == 'always' -%} {%- set active_top = nav.items | selectattr('active') | first -%} {%- if tabs_on -%} {%- set side_items = active_top.children if active_top and active_top.is_section else [] -%} {%- else -%} {%- set side_items = nav.items -%} {%- endif -%} {#- Wide, landing and blog pages have no sidebar, but the small-screen drawer still lists the nav, so phones keep a menu. -#} {%- set drawer_items = side_items if layout in ('wide', 'landing', 'blog') and 'sidebar' not in hide and 'navigation' not in hide else [] -%} {%- if 'sidebar' in hide or 'navigation' in hide or layout in ('wide', 'landing', 'blog') -%}{%- set side_items = [] -%}{%- endif -%} {#- On small screens the header tabs are hidden, so the drawer lists them too. -#} {%- set drawer_tabs = tabs_on and 'navigation' not in hide -%} {%- set toc_list = page.toc.items if page and page.toc else [] -%} {%- if toc_list | length == 1 and toc_list[0].level == 1 -%}{%- set toc_list = toc_list[0].children -%}{%- endif -%} {%- set show_toc = toc_list | length > 0 and 'toc' not in hide and layout not in ('wide', 'landing', 'blog') -%} {#- A page with nothing beside its content (no sidebar, no table of contents): the header and footer line up with the content. -#} {%- set land_toc = page and page.meta and page.meta.sections is iterable and page.meta.sections is not string and (page.meta.sections | selectattr('toc', 'defined') | selectattr('toc') | list) -%} {%- set narrow = not side_items and not show_toc and not land_toc and layout != 'wide' -%} {#- Versions kept in folders of the site (`theme.versions`): the first is the latest. -#} {%- set versions = theme.versions if theme.versions is iterable and theme.versions is not string else [] -%} {%- set vns = namespace(current=versions[0] if versions else None) -%} {%- for v in versions if v.path and page and page.url.startswith(v.path) %}{% set vns.current = v %}{% endfor -%} {%- block site_meta %} {%- set description = page.meta.description if page and page.meta and page.meta.description else config.site_description -%} {%- if description %}{% endif %} {%- if config.site_author %}{% endif %} {%- if page and page.canonical_url %}{% endif %} {%- if page and page.previous_page %}{% endif %} {%- if page and page.next_page %}{% endif %} {%- if i18n and page %} {%- for alt in i18n.languages if alt.available %} {%- if alt.lang == i18n.default_language %} {%- endif %} {%- endfor %} {%- endif %} {%- if sumi.markdown_url %}{% endif %} {%- if sumi.llms_txt %}{% endif %} {%- if sumi.feed_url %}{% endif %} {%- if page and page.title %} {%- set og_image = page.meta.image if page.meta and page.meta.image else theme.social_image -%} {%- if og_image and not (og_image.startswith('http://') or og_image.startswith('https://')) -%} {%- set og_image = config.site_url.rstrip('/') ~ '/' ~ og_image.lstrip('/') if config.site_url else None -%} {%- endif %} {%- set og_title = config.site_name if page.is_homepage else page.title | striptags %} {%- if description %}{% endif %} {%- if page.canonical_url %}{% endif %} {%- if og_image %}{% endif %} {%- if sumi.is_post and page.meta.date %}{% endif %} {%- if description %}{% endif %} {%- endif %} {%- endblock %} {%- block htmltitle %} {% if page and page.title and not page.is_homepage %}{{ page.title | striptags | e }} ยท {% endif %}{{ config.site_name | e }} {%- endblock %} {%- block styles %} {%- if theme.accent %}{{ m.accent_style(theme.accent) }}{% endif %} {%- if 'math' in (sumi.features or []) %}{% endif %} {%- for path in config.extra_css %}{% endfor %} {%- endblock %} {%- block analytics %}{% include "partials/analytics.html" %}{% endblock %} {%- block extrahead %}{% endblock %} {{ t('skip_to_content') }} {#- `announce` and `outdated` are Material's block names, so a Material `main.html` override keeps working. -#} {%- set announce = self.announce() | trim %} {%- if announce %}
{% block announce %}{% if theme.announcement %}{{ theme.announcement | sumi_links }}{% endif %}{% endblock %}
{%- endif %} {%- block header %}{% include "partials/header.html" %}{% endblock %} {%- set outdated = self.outdated() | trim %} {%- if versions and vns.current is not sameas versions[0] %}
{% if outdated %}{{ outdated }}{% else %}{{ t('old_version') }} {{ t('go_latest') }}{% endif %}
{%- else %} {#- With `version_provider: mike`, sumi.js shows this on an old version; empty, it writes the default text. -#} {%- endif %} {%- block layout %}
{%- include "partials/sidebar.html" %}
{%- block content %}
{%- if 'breadcrumbs' not in hide %}{% include "partials/breadcrumbs.html" %}{% endif %} {%- if 'actions' not in hide %}{% include "partials/page-actions.html" %}{% endif %}
{%- if show_toc %}
{{ icon('list') }}{{ t('on_this_page') }}{{ icon('chevron-down', 'sumi-chevron') }} {% include "partials/toc.html" %}
{%- endif %}
{%- include "partials/untranslated.html" %} {%- block page_content %}{{ page.content }}{% endblock %}
{%- block article_footer %}{% include "partials/article-footer.html" %}{% endblock %}
{%- endblock %}
{%- if show_toc %} {%- endif %}
{%- endblock %} {%- block footer %}{% if 'footer' not in hide %}{% include "partials/footer.html" %}{% endif %}{% endblock %} {% include "partials/palette.html" %} {%- block scripts %} {%- for script in config.extra_javascript %}{{ script | script_tag }}{% endfor %} {%- endblock %}