Skip to content

Commit dc83ea1

Browse files
add original header.html of mkdocs-material-8.3.9
1 parent 2fc7224 commit dc83ea1

File tree

1 file changed

+138
-18
lines changed

1 file changed

+138
-18
lines changed

custom-theme/partials/header.html

Lines changed: 138 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,161 @@
1-
<header class="md-header" data-md-component="header">
2-
<nav class="md-header-nav md-grid" aria-label="{{ lang.t('header.title') }}">
3-
<a href="{{ config.site_url | default(nav.homepage.url, true) | url }}" title="{{ config.site_name }} Version {{ config.extra.guideline_version }}" class="md-header-nav__button md-logo" aria-label="{{ config.site_name }}">
1+
<!--
2+
Copyright (c) 2016-2022 Martin Donath <martin.donath@squidfunk.com>
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 class according to configuration -->
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.title') }}"
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+
>
444
{% include "partials/logo.html" %}
545
</a>
6-
<label class="md-header-nav__button md-icon" for="__drawer">
46+
47+
<!-- Button to open drawer -->
48+
<label class="md-header__button md-icon" for="__drawer">
749
{% include ".icons/material/menu" ~ ".svg" %}
850
</label>
9-
<div class="md-header-nav__title" data-md-component="header-title">
10-
{% if config.site_name == page.title %}
11-
<div class="md-header-nav__ellipsis md-ellipsis">
12-
{{ config.site_name }} Version {{ config.extra.guideline_version }}
13-
</div>
14-
{% else %}
15-
<div class="md-header-nav__ellipsis">
16-
<span class="md-header-nav__topic md-ellipsis">
17-
{{ config.site_name }} Version {{ config.extra.guideline_version }}
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 }}
1858
</span>
19-
<span class="md-header-nav__topic md-ellipsis">
20-
{% if page and page.meta and page.meta.title %}
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 %}
2163
{{ page.meta.title }}
2264
{% else %}
2365
{{ page.title }}
2466
{% endif %}
2567
</span>
2668
</div>
27-
{% endif %}
69+
</div>
2870
</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 primary = option.primary | replace(" ", "-") | lower %}
77+
{% set accent = option.accent | replace(" ", "-") | lower %}
78+
<input
79+
class="md-option"
80+
data-md-color-media="{{ option.media }}"
81+
data-md-color-scheme="{{ option.scheme }}"
82+
data-md-color-primary="{{ primary }}"
83+
data-md-color-accent="{{ accent }}"
84+
{% if option.toggle %}
85+
aria-label="{{ option.toggle.name }}"
86+
{% else %}
87+
aria-hidden="true"
88+
{% endif %}
89+
type="radio"
90+
name="__palette"
91+
id="__palette_{{ loop.index }}"
92+
/>
93+
{% if option.toggle %}
94+
<label
95+
class="md-header__button md-icon"
96+
title="{{ option.toggle.name }}"
97+
for="__palette_{{ loop.index0 or loop.length }}"
98+
hidden
99+
>
100+
{% include ".icons/" ~ option.toggle.icon ~ ".svg" %}
101+
</label>
102+
{% endif %}
103+
{% endfor %}
104+
</form>
105+
{% endif %}
106+
107+
<!-- Site language selector -->
108+
{% if config.extra.alternate %}
109+
<div class="md-header__option"></form>
110+
<div class="md-select">
111+
{% set icon = config.theme.icon.alternate or "material/translate" %}
112+
<button
113+
class="md-header__button md-icon"
114+
aria-label="{{ lang.t('select.language.title') }}"
115+
>
116+
{% include ".icons/" ~ icon ~ ".svg" %}
117+
</button>
118+
<div class="md-select__inner">
119+
<ul class="md-select__list">
120+
{% for alt in config.extra.alternate %}
121+
<li class="md-select__item">
122+
<a
123+
href="{{ alt.link | url }}"
124+
hreflang="{{ alt.lang }}"
125+
class="md-select__link"
126+
>
127+
{{ alt.name }}
128+
</a>
129+
</li>
130+
{% endfor %}
131+
</ul>
132+
</div>
133+
</div>
134+
</div>
135+
{% endif %}
136+
137+
<!-- Button to open search modal -->
29138
{% if "search" in config["plugins"] %}
30-
<label class="md-header-nav__button md-icon" for="__search">
139+
<label class="md-header__button md-icon" for="__search">
31140
{% include ".icons/material/magnify.svg" %}
32141
</label>
142+
143+
<!-- Search interface -->
33144
{% include "partials/search.html" %}
34145
{% endif %}
146+
147+
<!-- Repository information -->
35148
{% if config.repo_url %}
36-
<div class="md-header-nav__source">
149+
<div class="md-header__source">
37150
{% include "partials/source.html" %}
38151
</div>
39152
{% endif %}
40153
</nav>
154+
155+
<!-- Navigation tabs (sticky) -->
156+
{% if "navigation.tabs.sticky" in features %}
157+
{% if "navigation.tabs" in features %}
158+
{% include "partials/tabs.html" %}
159+
{% endif %}
160+
{% endif %}
41161
</header>

0 commit comments

Comments
 (0)