Skip to content

Commit a69739a

Browse files
mkdocs: header logo links to parent website
custom header template - header logo links to practical.li website - header title links to front page of book
1 parent 205fe48 commit a69739a

File tree

3 files changed

+115
-0
lines changed

3 files changed

+115
-0
lines changed

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ site_name: Practicalli Clojure Web Services
44
site_url: https://practical.li/clojure-web-services
55
site_description: Practical guide to Clojure Web Services and APIs
66
site_author: Practicalli
7+
site_org: https://practical.li
78
copyright: Copyright &copy 2023 Practicali <a href="https://creativecommons.org/licenses/by-sa/4.0/">CC BY-SA 4.0</a>
89
repo_url: https://github.com/practicalli/clojure-web-services/
910
edit_uri: https://github.com/practicalli/clojure-web-services/edit/main/docs/

overrides/partials/header.html

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<!-- Determine classes -->
2+
{% set class = "md-header" %} {% if "navigation.tabs.sticky" in features %} {%
3+
set class = class ~ " md-header--shadow md-header--lifted" %} {% elif
4+
"navigation.tabs" not in features %} {% set class = class ~ " md-header--shadow"
5+
%} {% endif %}
6+
7+
<!-- Header -->
8+
<header class="{{ class }}" data-md-component="header">
9+
<nav class="md-header__inner md-grid" aria-label="{{ lang.t('header') }}">
10+
<!-- Link to home -->
11+
12+
<!-- Button to open drawer -->
13+
<label class="md-header__button md-icon" for="__drawer">
14+
{% set icon = config.theme.icon.menu or "material/menu" %} {% include
15+
".icons/" ~ icon ~ ".svg" %}
16+
</label>
17+
18+
<!-- Custom: Link to Practical.li -->
19+
<a
20+
href="{{ config.site_org | url }}"
21+
title="{{ config.site_org | e }}"
22+
class="md-header__button md-logo"
23+
aria-label="{{ config.site_org }}"
24+
data-md-component="logo"
25+
target="_blank"
26+
>
27+
{% include "partials/logo.html" %}
28+
</a>
29+
30+
<!-- Header title -->
31+
<div class="md-header__title" data-md-component="header-title">
32+
<div class="md-header__ellipsis">
33+
<div class="md-header__topic">
34+
<a
35+
href="{{ config.site_url | url }}"
36+
title="{{ config.site_name | e }}"
37+
aria-label="{{ config.site_name }}"
38+
>
39+
<span class="md-ellipsis"> {{ config.site_name }} </span>
40+
</a>
41+
</div>
42+
<div class="md-header__topic" data-md-component="header-topic">
43+
<span class="md-ellipsis">
44+
{% if page.meta and page.meta.title %} {{ page.meta.title }} {% else
45+
%} {{ page.title }} {% endif %}
46+
</span>
47+
</div>
48+
</div>
49+
</div>
50+
51+
<!-- Color palette toggle -->
52+
{% if config.theme.palette %} {% if not config.theme.palette is mapping %}
53+
{% include "partials/palette.html" %} {% endif %} {% endif %}
54+
55+
<!-- Site language selector -->
56+
{% if config.extra.alternate %} {% include "partials/alternate.html" %} {%
57+
endif %}
58+
59+
<!-- Button to open search modal -->
60+
{% if "material/search" in config.plugins %}
61+
<label class="md-header__button md-icon" for="__search">
62+
{% set icon = config.theme.icon.search or "material/magnify" %} {% include
63+
".icons/" ~ icon ~ ".svg" %}
64+
</label>
65+
66+
<!-- Search interface -->
67+
{% include "partials/search.html" %} {% endif %}
68+
69+
<!-- Repository information -->
70+
{% if config.repo_url %}
71+
<div class="md-header__source">{% include "partials/source.html" %}</div>
72+
{% endif %}
73+
</nav>
74+
75+
<!-- Navigation tabs (sticky) -->
76+
{% if "navigation.tabs.sticky" in features %} {% if "navigation.tabs" in
77+
features %} {% include "partials/tabs.html" %} {% endif %} {% endif %}
78+
</header>

overrides/partials/palette.html

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<!-- Added to support header.html partial -->
2+
<!-- - no changes applied -->
3+
4+
<!-- Color palette toggle -->
5+
<form class="md-header__option" data-md-component="palette">
6+
{% for option in config.theme.palette %}
7+
{% set scheme = option.scheme | d("default", true) %}
8+
{% set primary = option.primary | d("indigo", true) %}
9+
{% set accent = option.accent | d("indigo", true) %}
10+
<input
11+
class="md-option"
12+
data-md-color-media="{{ option.media }}"
13+
data-md-color-scheme="{{ scheme | replace(' ', '-') }}"
14+
data-md-color-primary="{{ primary | replace(' ', '-') }}"
15+
data-md-color-accent="{{ accent | replace(' ', '-') }}"
16+
{% if option.toggle %}
17+
aria-label="{{ option.toggle.name }}"
18+
{% else %}
19+
aria-hidden="true"
20+
{% endif %}
21+
type="radio"
22+
name="__palette"
23+
id="__palette_{{ loop.index }}"
24+
/>
25+
{% if option.toggle %}
26+
<label
27+
class="md-header__button md-icon"
28+
title="{{ option.toggle.name }}"
29+
for="__palette_{{ loop.index0 or loop.length }}"
30+
hidden
31+
>
32+
{% include ".icons/" ~ option.toggle.icon ~ ".svg" %}
33+
</label>
34+
{% endif %}
35+
{% endfor %}
36+
</form>

0 commit comments

Comments
 (0)