Skip to content

Commit 2c19a28

Browse files
Add cookie consent
Add cookie consent to header
1 parent b23d572 commit 2c19a28

File tree

2 files changed

+130
-132
lines changed

2 files changed

+130
-132
lines changed

mkdocs.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,18 @@ extra:
316316
provider: google
317317
property: G-7Y7EYCZVC1
318318

319+
consent:
320+
cookies:
321+
analytics:
322+
name: Google Analytics
323+
checked: true
324+
title: Cookie consent
325+
description:
326+
We use cookies to recognize your repeated visits and preferences, as well as to measure the effectiveness of our documentation and whether users find what they're searching for. With your consent, you're helping us to make our documentation better.
327+
actions:
328+
- accept
329+
- manage
330+
- reject
319331

320332

321333
# Configures styling for PDF rendering and webpage layout

overrides/partials/header.html

Lines changed: 118 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
Copyright (c) 2016-2023 Martin Donath <[email protected]>
2+
Copyright (c) 2016-2024 Martin Donath <[email protected]>
33
44
Permission is hereby granted, free of charge, to any person obtaining a copy
55
of this software and associated documentation files (the "Software"), to
@@ -20,7 +20,7 @@
2020
IN THE SOFTWARE.
2121
-->
2222

23-
<!-- Determine base classes -->
23+
<!-- Determine classes -->
2424
{% set class = "md-header" %}
2525
{% if "navigation.tabs.sticky" in features %}
2626
{% set class = class ~ " md-header--shadow md-header--lifted" %}
@@ -31,141 +31,127 @@
3131
<!-- Header -->
3232
<header class="{{ class }}" data-md-component="header">
3333
<nav
34-
class="md-header__inner md-grid"
35-
aria-label="{{ lang.t('header') }}"
34+
class="md-header__inner md-grid"
35+
aria-label="{{ lang.t('header') }}"
3636
>
3737

38-
<!-- Link to home -->
39-
<!-- <a
40-
href="{{ config.extra.homepage | d(nav.homepage.url, true) | url }}"
41-
title="{{ config.site_name | e }}"
42-
class="md-header__button md-logo"
43-
aria-label="{{ config.site_name }}"
44-
data-md-component="logo"
45-
>
46-
{% include "partials/logo.html" %}
47-
</a> -->
48-
<a
49-
href="{{ config.extra.homepage | d(nav.homepage.url, true) | url }}"
50-
title="sparkfun.com"
51-
class="md-header__button md-logo"
52-
aria-label="{{ config.site_name }}"
53-
data-md-component="logo"
54-
>
55-
{% include "partials/logo.html" %}
56-
</a>
57-
58-
<!-- Button to open drawer -->
59-
<label class="md-header__button md-icon" for="__drawer">
60-
{% include ".icons/material/menu" ~ ".svg" %}
61-
</label>
62-
63-
<!-- Header title -->
64-
<div class="md-header__title" data-md-component="header-title">
65-
<div class="md-header__ellipsis">
66-
<div class="md-header__topic">
67-
<span class="md-ellipsis">
68-
{{ config.site_name }}
69-
</span>
70-
</div>
71-
<div class="md-header__topic" data-md-component="header-topic">
72-
<span class="md-ellipsis">
73-
{% if page.meta and page.meta.title %}
74-
{{ page.meta.title }}
75-
{% else %}
76-
{{ page.title }}
77-
{% endif %}
78-
</span>
79-
</div>
80-
</div>
81-
</div>
82-
83-
<!-- Color palette -->
84-
{% if not config.theme.palette is mapping %}
85-
<form class="md-header__option" data-md-component="palette">
86-
{% for option in config.theme.palette %}
87-
{% set scheme = option.scheme | d("default", true) %}
88-
<input
89-
class="md-option"
90-
data-md-color-media="{{ option.media }}"
91-
data-md-color-scheme="{{ scheme | replace(' ', '-') }}"
92-
data-md-color-primary="{{ option.primary | replace(' ', '-') }}"
93-
data-md-color-accent="{{ option.accent | replace(' ', '-') }}"
94-
{% if option.toggle %}
95-
aria-label="{{ option.toggle.name }}"
96-
{% else %}
97-
aria-hidden="true"
98-
{% endif %}
99-
type="radio"
100-
name="__palette"
101-
id="__palette_{{ loop.index }}"
102-
/>
103-
{% if option.toggle %}
104-
<label
105-
class="md-header__button md-icon"
106-
title="{{ option.toggle.name }}"
107-
for="__palette_{{ loop.index0 or loop.length }}"
108-
hidden
109-
>
110-
{% include ".icons/" ~ option.toggle.icon ~ ".svg" %}
111-
</label>
112-
{% endif %}
113-
{% endfor %}
114-
</form>
115-
{% endif %}
116-
117-
<!-- Site language selector -->
118-
{% if config.extra.alternate %}
119-
<div class="md-header__option">
120-
<div class="md-select">
121-
{% set icon = config.theme.icon.alternate or "material/translate" %}
122-
<button
123-
class="md-header__button md-icon"
124-
aria-label="{{ lang.t('select.language') }}"
125-
>
126-
{% include ".icons/" ~ icon ~ ".svg" %}
127-
</button>
128-
<div class="md-select__inner">
129-
<ul class="md-select__list">
130-
{% for alt in config.extra.alternate %}
131-
<li class="md-select__item">
132-
<a
133-
href="{{ alt.link | url }}"
134-
hreflang="{{ alt.lang }}"
135-
class="md-select__link"
136-
>
137-
{{ alt.name }}
138-
</a>
139-
</li>
140-
{% endfor %}
141-
</ul>
142-
</div>
143-
</div>
144-
</div>
145-
{% endif %}
146-
147-
<!-- Button to open search modal -->
148-
{% if "material/search" in config.plugins %}
149-
<label class="md-header__button md-icon" for="__search">
150-
{% include ".icons/material/magnify.svg" %}
151-
</label>
152-
153-
<!-- Search interface -->
154-
{% include "partials/search.html" %}
155-
{% endif %}
156-
157-
<!-- Repository information -->
158-
{% if config.repo_url %}
159-
<div class="md-header__source">
160-
{% include "partials/source.html" %}
161-
</div>
162-
{% endif %}
38+
<!-- Link to home -->
39+
<!-- <a
40+
href="{{ config.extra.homepage | d(nav.homepage.url, true) | url }}"
41+
title="{{ config.site_name | e }}"
42+
class="md-header__button md-logo"
43+
aria-label="{{ config.site_name }}"
44+
data-md-component="logo"
45+
>
46+
{% include "partials/logo.html" %}
47+
</a> -->
48+
<a
49+
href="{{ config.extra.homepage | d(nav.homepage.url, true) | url }}"
50+
title="www.sparkfun.com/pnt"
51+
class="md-header__button md-logo"
52+
aria-label="{{ config.site_name }}"
53+
data-md-component="logo"
54+
>
55+
{% include "partials/logo.html" %}
56+
</a>
57+
58+
<!-- Button to open drawer -->
59+
<label class="md-header__button md-icon" for="__drawer">
60+
{% set icon = config.theme.icon.menu or "material/menu" %}
61+
{% include ".icons/" ~ icon ~ ".svg" %}
62+
</label>
63+
64+
<!-- Header title -->
65+
<div class="md-header__title" data-md-component="header-title">
66+
<div class="md-header__ellipsis">
67+
<div class="md-header__topic">
68+
<span class="md-ellipsis">
69+
{{ config.site_name }}
70+
</span>
71+
</div>
72+
<div class="md-header__topic" data-md-component="header-topic">
73+
<span class="md-ellipsis">
74+
{% if page.meta and page.meta.title %}
75+
{{ page.meta.title }}
76+
{% else %}
77+
{{ page.title }}
78+
{% endif %}
79+
</span>
80+
</div>
81+
</div>
82+
</div>
83+
84+
85+
<!-- Color palette -->
86+
{% if not config.theme.palette is mapping %}
87+
<form class="md-header__option" data-md-component="palette">
88+
{% for option in config.theme.palette %}
89+
{% set scheme = option.scheme | d("default", true) %}
90+
<input
91+
class="md-option"
92+
data-md-color-media="{{ option.media }}"
93+
data-md-color-scheme="{{ scheme | replace(' ', '-') }}"
94+
data-md-color-primary="{{ option.primary | replace(' ', '-') }}"
95+
data-md-color-accent="{{ option.accent | replace(' ', '-') }}"
96+
{% if option.toggle %}
97+
aria-label="{{ option.toggle.name }}"
98+
{% else %}
99+
aria-hidden="true"
100+
{% endif %}
101+
type="radio"
102+
name="__palette"
103+
id="__palette_{{ loop.index }}"
104+
/>
105+
{% if option.toggle %}
106+
<label
107+
class="md-header__button md-icon"
108+
title="{{ option.toggle.name }}"
109+
for="__palette_{{ loop.index0 or loop.length }}"
110+
hidden
111+
>
112+
{% include ".icons/" ~ option.toggle.icon ~ ".svg" %}
113+
</label>
114+
{% endif %}
115+
{% endfor %}
116+
</form>
117+
{% endif %}
118+
119+
<!-- Button for Cookie Consent -->
120+
<label class="md-header__button md-icon">
121+
<a href="#__consent" title="Manage Cookies">
122+
{% include ".icons/material/cookie-edit.svg" %}
123+
</a>
124+
</label>
125+
126+
127+
<!-- Site language selector -->
128+
{% if config.extra.alternate %}
129+
{% include "partials/alternate.html" %}
130+
{% endif %}
131+
132+
<!-- Button to open search modal -->
133+
{% if "material/search" in config.plugins %}
134+
<label class="md-header__button md-icon" for="__search">
135+
{% set icon = config.theme.icon.search or "material/magnify" %}
136+
{% include ".icons/" ~ icon ~ ".svg" %}
137+
</label>
138+
139+
<!-- Search interface -->
140+
{% include "partials/search.html" %}
141+
{% endif %}
142+
143+
<!-- Repository information -->
144+
{% if config.repo_url %}
145+
<div class="md-header__source">
146+
{% include "partials/source.html" %}
147+
</div>
148+
{% endif %}
163149
</nav>
164150

165151
<!-- Navigation tabs (sticky) -->
166152
{% if "navigation.tabs.sticky" in features %}
167-
{% if "navigation.tabs" in features %}
168-
{% include "partials/tabs.html" %}
169-
{% endif %}
153+
{% if "navigation.tabs" in features %}
154+
{% include "partials/tabs.html" %}
155+
{% endif %}
170156
{% endif %}
171157
</header>

0 commit comments

Comments
 (0)