|
| 1 | +{#- |
| 2 | + Local override of material/partials/header.html. |
| 3 | + |
| 4 | + Local modifications vs. the upstream partial: |
| 5 | + |
| 6 | + 1. The site-name topic in ``.md-header__title`` is rendered as an |
| 7 | + ``<a>`` (carrying the ``md-header__topic`` class) so the visible |
| 8 | + "OpenArmature" wordmark navigates home. Upstream's default leaves |
| 9 | + that topic as a plain ``<div>``; the only header-area link is the |
| 10 | + icon-style ``md-logo`` button, which our extra.css hides because |
| 11 | + we want the wordmark on its own. |
| 12 | + 2. On the homepage (``page.is_homepage``), the ``.md-header__title`` |
| 13 | + element gets an extra ``md-header__title--pinned`` class and the |
| 14 | + second ``.md-header__topic`` (the page-title topic) is not |
| 15 | + rendered. A paired rule in extra.css pins the wordmark in place |
| 16 | + regardless of ``data-md-state="topic"`` so the scroll animation |
| 17 | + doesn't fire; we omit the page-title topic because on the |
| 18 | + homepage it would just be an un-bold copy of "OpenArmature". |
| 19 | + |
| 20 | + Re-sync this file when bumping mkdocs-material; preserve both |
| 21 | + modifications. Everything below is otherwise verbatim from the |
| 22 | + upstream partial. |
| 23 | +-#} |
| 24 | +{% set class = "md-header" %} |
| 25 | +{% if "navigation.tabs.sticky" in features %} |
| 26 | + {% set class = class ~ " md-header--shadow md-header--lifted" %} |
| 27 | +{% elif "navigation.tabs" not in features %} |
| 28 | + {% set class = class ~ " md-header--shadow" %} |
| 29 | +{% endif %} |
| 30 | +<header class="{{ class }}" data-md-component="header"> |
| 31 | + <nav class="md-header__inner md-grid" aria-label="{{ lang.t('header') }}"> |
| 32 | + <a href="{{ config.extra.homepage | d(nav.homepage.url, true) | url }}" title="{{ config.site_name | e }}" class="md-header__button md-logo" aria-label="{{ config.site_name }}" data-md-component="logo"> |
| 33 | + {% include "partials/logo.html" %} |
| 34 | + </a> |
| 35 | + <label class="md-header__button md-icon" for="__drawer"> |
| 36 | + {% set icon = config.theme.icon.menu or "material/menu" %} |
| 37 | + {% include ".icons/" ~ icon ~ ".svg" %} |
| 38 | + </label> |
| 39 | + {#- LOCAL OVERRIDE: pin the wordmark on the homepage. The page title |
| 40 | + there is also "OpenArmature", so Material's default scroll |
| 41 | + animation flips between the bold wordmark and the un-bold page |
| 42 | + title of the same text, which reads as a glitch. On the |
| 43 | + homepage we tag the title element so extra.css can suppress the |
| 44 | + swap, and we skip rendering the page-title topic entirely. -#} |
| 45 | + <div class="md-header__title{% if page.is_homepage %} md-header__title--pinned{% endif %}" data-md-component="header-title"> |
| 46 | + <div class="md-header__ellipsis"> |
| 47 | + {# LOCAL OVERRIDE: render the site-name topic as an <a> so the |
| 48 | + wordmark is clickable. Material's default markup is a plain |
| 49 | + <div class="md-header__topic">; we substitute an anchor that |
| 50 | + carries the same .md-header__topic class so the theme's |
| 51 | + positioning rules (which target direct children of |
| 52 | + .md-header__ellipsis) still apply. #} |
| 53 | + <a href="{{ config.extra.homepage | d(nav.homepage.url, true) | url }}" class="md-header__topic md-header__topic-link" aria-label="{{ config.site_name }}"> |
| 54 | + <span class="md-ellipsis"> |
| 55 | + {{ config.site_name }} |
| 56 | + </span> |
| 57 | + </a> |
| 58 | + {% if not page.is_homepage %} |
| 59 | + <div class="md-header__topic" data-md-component="header-topic"> |
| 60 | + <span class="md-ellipsis"> |
| 61 | + {% if page.meta and page.meta.title %} |
| 62 | + {{ page.meta.title }} |
| 63 | + {% else %} |
| 64 | + {{ page.title }} |
| 65 | + {% endif %} |
| 66 | + </span> |
| 67 | + </div> |
| 68 | + {% endif %} |
| 69 | + </div> |
| 70 | + </div> |
| 71 | + {% if config.theme.palette %} |
| 72 | + {% if not config.theme.palette is mapping %} |
| 73 | + {% include "partials/palette.html" %} |
| 74 | + {% endif %} |
| 75 | + {% endif %} |
| 76 | + {% if not config.theme.palette is mapping %} |
| 77 | + {% include "partials/javascripts/palette.html" %} |
| 78 | + {% endif %} |
| 79 | + {% if config.extra.alternate %} |
| 80 | + {% include "partials/alternate.html" %} |
| 81 | + {% endif %} |
| 82 | + {% if "material/search" in config.plugins %} |
| 83 | + {% set search = config.plugins["material/search"] | attr("config") %} |
| 84 | + {% if search.enabled %} |
| 85 | + <label class="md-header__button md-icon" for="__search"> |
| 86 | + {% set icon = config.theme.icon.search or "material/magnify" %} |
| 87 | + {% include ".icons/" ~ icon ~ ".svg" %} |
| 88 | + </label> |
| 89 | + {% include "partials/search.html" %} |
| 90 | + {% endif %} |
| 91 | + {% endif %} |
| 92 | + {% if config.repo_url %} |
| 93 | + <div class="md-header__source"> |
| 94 | + {% include "partials/source.html" %} |
| 95 | + </div> |
| 96 | + {% endif %} |
| 97 | + </nav> |
| 98 | + {% if "navigation.tabs.sticky" in features %} |
| 99 | + {% if "navigation.tabs" in features %} |
| 100 | + {% include "partials/tabs.html" %} |
| 101 | + {% endif %} |
| 102 | + {% endif %} |
| 103 | +</header> |
0 commit comments