|
| 1 | +<!-- |
| 2 | + Copyright (c) 2016-2023 Martin Donath <[email protected]> |
| 3 | +
|
| 4 | + Permission is hereby granted, free of charge, to any person obtaining a copy |
| 5 | + of this software and associated documentation files (the "Software"), to |
| 6 | + deal in the Software without restriction, including without limitation the |
| 7 | + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
| 8 | + sell copies of the Software, and to permit persons to whom the Software is |
| 9 | + furnished to do so, subject to the following conditions: |
| 10 | +
|
| 11 | + The above copyright notice and this permission notice shall be included in |
| 12 | + all copies or substantial portions of the Software. |
| 13 | +
|
| 14 | + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 15 | + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 16 | + FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE |
| 17 | + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 18 | + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 19 | + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS |
| 20 | + IN THE SOFTWARE. |
| 21 | +--> |
| 22 | + |
| 23 | +<!-- Determine base classes --> |
| 24 | +{% set class = "md-header" %} |
| 25 | +{% if "navigation.tabs.sticky" in features %} |
| 26 | + {% set class = class ~ " md-header--lifted" %} |
| 27 | +{% endif %} |
| 28 | + |
| 29 | +<!-- Header --> |
| 30 | +<header class="{{ class }}" data-md-component="header"> |
| 31 | + <nav |
| 32 | + class="md-header__inner md-grid" |
| 33 | + aria-label="{{ lang.t('header') }}" |
| 34 | + > |
| 35 | + |
| 36 | + <!-- Link to home --> |
| 37 | + <a |
| 38 | + href="{{ config.extra.homepage | d(nav.homepage.url, true) | url }}" |
| 39 | + title="{{ config.site_name | e }}" |
| 40 | + class="md-header__button md-logo" |
| 41 | + aria-label="{{ config.site_name }}" |
| 42 | + data-md-component="logo" |
| 43 | + > |
| 44 | + {% include "partials/logo.html" %} |
| 45 | + </a> |
| 46 | + |
| 47 | + <!-- Button to open drawer --> |
| 48 | + <label class="md-header__button md-icon" for="__drawer"> |
| 49 | + {% include ".icons/material/menu" ~ ".svg" %} |
| 50 | + </label> |
| 51 | + |
| 52 | + <!-- Header title --> |
| 53 | + <div class="md-header__title" data-md-component="header-title"> |
| 54 | + <div class="md-header__ellipsis"> |
| 55 | + <div class="md-header__topic"> |
| 56 | + <span class="md-ellipsis"> |
| 57 | + {{ config.site_name }} |
| 58 | + </span> |
| 59 | + </div> |
| 60 | + <div class="md-header__topic" data-md-component="header-topic"> |
| 61 | + <span class="md-ellipsis"> |
| 62 | + {% if page.meta and page.meta.title %} |
| 63 | + {{ page.meta.title }} |
| 64 | + {% else %} |
| 65 | + {{ page.title }} |
| 66 | + {% endif %} |
| 67 | + </span> |
| 68 | + </div> |
| 69 | + </div> |
| 70 | + </div> |
| 71 | + |
| 72 | + <!-- Color palette --> |
| 73 | + {% if not config.theme.palette is mapping %} |
| 74 | + <form class="md-header__option" data-md-component="palette"> |
| 75 | + {% for option in config.theme.palette %} |
| 76 | + {% set scheme = option.scheme | d("default", true) %} |
| 77 | + <input |
| 78 | + class="md-option" |
| 79 | + data-md-color-media="{{ option.media }}" |
| 80 | + data-md-color-scheme="{{ scheme | replace(' ', '-') }}" |
| 81 | + data-md-color-primary="{{ option.primary | replace(' ', '-') }}" |
| 82 | + data-md-color-accent="{{ option.accent | replace(' ', '-') }}" |
| 83 | + {% if option.toggle %} |
| 84 | + aria-label="{{ option.toggle.name }}" |
| 85 | + {% else %} |
| 86 | + aria-hidden="true" |
| 87 | + {% endif %} |
| 88 | + type="radio" |
| 89 | + name="__palette" |
| 90 | + id="__palette_{{ loop.index }}" |
| 91 | + /> |
| 92 | + {% if option.toggle %} |
| 93 | + <label |
| 94 | + class="md-header__button md-icon" |
| 95 | + title="{{ option.toggle.name }}" |
| 96 | + for="__palette_{{ loop.index0 or loop.length }}" |
| 97 | + hidden |
| 98 | + > |
| 99 | + {% include ".icons/" ~ option.toggle.icon ~ ".svg" %} |
| 100 | + </label> |
| 101 | + {% endif %} |
| 102 | + {% endfor %} |
| 103 | + </form> |
| 104 | + {% endif %} |
| 105 | + |
| 106 | + <!-- Site language selector --> |
| 107 | + {% if config.extra.alternate %} |
| 108 | + <div class="md-header__option"> |
| 109 | + <div class="md-select"> |
| 110 | + {% set icon = config.theme.icon.alternate or "material/translate" %} |
| 111 | + <button |
| 112 | + class="md-header__button md-icon" |
| 113 | + aria-label="{{ lang.t('select.language') }}" |
| 114 | + > |
| 115 | + {% include ".icons/" ~ icon ~ ".svg" %} |
| 116 | + </button> |
| 117 | + <div class="md-select__inner"> |
| 118 | + <ul class="md-select__list"> |
| 119 | + {% for alt in config.extra.alternate %} |
| 120 | + <li class="md-select__item"> |
| 121 | + <a |
| 122 | + href="{{ alt.link | url }}" |
| 123 | + hreflang="{{ alt.lang }}" |
| 124 | + class="md-select__link" |
| 125 | + > |
| 126 | + {{ alt.name }} |
| 127 | + </a> |
| 128 | + </li> |
| 129 | + {% endfor %} |
| 130 | + </ul> |
| 131 | + </div> |
| 132 | + </div> |
| 133 | + </div> |
| 134 | + {% endif %} |
| 135 | + |
| 136 | + <!-- Button to open search modal --> |
| 137 | + {% if "material/search" in config.plugins %} |
| 138 | + <label class="md-header__button md-icon" for="__search"> |
| 139 | + {% include ".icons/material/magnify.svg" %} |
| 140 | + </label> |
| 141 | + |
| 142 | + <!-- Search interface --> |
| 143 | + {% include "partials/search.html" %} |
| 144 | + {% endif %} |
| 145 | + |
| 146 | + <!-- Repository information --> |
| 147 | + {% if config.repo_url %} |
| 148 | + <div class="md-header__source"> |
| 149 | + {% include "partials/source.html" %} |
| 150 | + </div> |
| 151 | + {% endif %} |
| 152 | + </nav> |
| 153 | + |
| 154 | + <!-- Navigation tabs (sticky) --> |
| 155 | + {% if "navigation.tabs.sticky" in features %} |
| 156 | + {% if "navigation.tabs" in features %} |
| 157 | + {% include "partials/tabs.html" %} |
| 158 | + {% endif %} |
| 159 | + {% endif %} |
| 160 | +</header> |
0 commit comments