Skip to content

Commit 30a4d58

Browse files
committed
Added documentation for cookie consent
1 parent 580f118 commit 30a4d58

File tree

9 files changed

+62
-31
lines changed

9 files changed

+62
-31
lines changed

docs/assets/screenshots/consent.png

235 KB
Loading

docs/insiders/index.md

+22-19
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,10 @@ The following features are currently exclusively available to sponsors:
117117

118118
<div class="mdx-columns" markdown="1">
119119

120+
- [x] [Cookie consent :material-new-box:][33]
120121
- [x] [Linking content tabs :material-new-box:][32]
121122
- [x] [Boosting pages in search :material-new-box:][30]
122-
- [x] [Tags (with search integration) :material-new-box:][29]
123+
- [x] [Tags (with search integration)][29]
123124
- [x] [Stay on page when switching versions][28]
124125
- [x] [Version warning][26]
125126
- [x] [Custom admonition icons][31]
@@ -192,33 +193,35 @@ the public for general availability.
192193
#### $ 6,000 – Trinidad Scorpion
193194

194195
- [x] [Boosting pages in search][30]
195-
- [ ] Improved search result summaries
196-
- [ ] Stay on page when switching languages
196+
- [x] [Custom admonition icons][31]
197+
- [x] [Linking content tabs][32]
197198

198199
[30]: ../setup/setting-up-site-search.md#boosting-a-page
200+
[31]: ../reference/admonitions.md#changing-the-icons
201+
[32]: ../reference/content-tabs.md#linking-content-tabs
199202

200203
#### $ 7,000 – Royal Gold
201204

205+
- [x] [Cookie consent][33]
202206
- [ ] Table of contents auto-collapse
203207
- [ ] Table of contents follows active anchor
204-
- [ ] Native lightbox integration
208+
209+
[33]: ../setup/setting-up-site-analytics.md#cookie-consent
205210

206211
#### $ 8,000 – Scotch Bonnet
207212

208-
- [x] [Custom admonition icons][31]
209-
- [x] [Linking content tabs][32]
213+
- [ ] Improved search result summaries
214+
- [ ] Stay on page when switching languages
210215
- [ ] List of last searches
211216

212-
[31]: ../reference/admonitions.md#changing-the-icons
213-
[32]: ../reference/content-tabs.md#linking-content-tabs
214-
215217
#### Future
216218

217-
- [ ] [Material for MkDocs Live Edit][33]
219+
- [ ] [Material for MkDocs Live Edit][34]
218220
- [ ] New layouts and styles
219221
- [ ] Code block palette toggle
222+
- [ ] Native lightbox integration
220223

221-
[33]: https://twitter.com/squidfunk/status/1338252230265360391
224+
[34]: https://twitter.com/squidfunk/status/1338252230265360391
222225

223226
### Goals completed
224227

@@ -273,23 +276,23 @@ implemented behind feature flags; all configuration changes are
273276
backward-compatible. This means that your users will be able to build the
274277
documentation locally with Material for MkDocs and when they push their changes,
275278
it can be built with Insiders (e.g. as part of GitHub Actions). Thus, it's
276-
recommended to [install Insiders][34] only in CI, as you don't want to expose
279+
recommended to [install Insiders][35] only in CI, as you don't want to expose
277280
your `GH_TOKEN` to users.
278281

279-
[34]: ../publishing-your-site.md#github-pages
282+
[35]: ../publishing-your-site.md#github-pages
280283

281284
### Payment
282285

283286
_We don't want to pay for sponsorship every month. Are there any other options?_
284287

285288
Yes. You can sponsor on a yearly basis by [switching your GitHub account to a
286-
yearly billing cycle][35]. If for some reason you cannot do that, you could
289+
yearly billing cycle][36]. If for some reason you cannot do that, you could
287290
also create a dedicated GitHub account with a yearly billing cycle, which you
288291
only use for sponsoring (some sponsors already do that).
289292

290293
One-time payments are not eligible for Insiders.
291294

292-
[35]: https://docs.github.com/en/github/setting-up-and-managing-billing-and-payments-on-github/changing-the-duration-of-your-billing-cycle
295+
[36]: https://docs.github.com/en/github/setting-up-and-managing-billing-and-payments-on-github/changing-the-duration-of-your-billing-cycle
293296

294297
### Terms
295298

@@ -298,7 +301,7 @@ commercial project. Can we use Insiders under the same terms and conditions?_
298301

299302
Yes. Whether you're an individual or a company, you may use _Material for MkDocs
300303
Insiders_ precisely under the same terms as Material for MkDocs, which are given
301-
by the [MIT license][36]. However, we kindly ask you to respect the following
304+
by the [MIT license][37]. However, we kindly ask you to respect the following
302305
guidelines:
303306

304307
- Please __don't distribute the source code__ of Insiders. You may freely use
@@ -309,7 +312,7 @@ guidelines:
309312
- If you cancel your subscription, you're removed as a collaborator and will
310313
miss out on future updates of Insiders. However, you may __use the latest
311314
version__ that's available to you __as long as you like__. Just remember that
312-
[GitHub deletes private forks][37].
315+
[GitHub deletes private forks][38].
313316

314-
[36]: ../license.md
315-
[37]: https://docs.github.com/en/github/setting-up-and-managing-your-github-user-account/removing-a-collaborator-from-a-personal-repository
317+
[37]: ../license.md
318+
[38]: https://docs.github.com/en/github/setting-up-and-managing-your-github-user-account/removing-a-collaborator-from-a-personal-repository

docs/setup/setting-up-site-analytics.md

+35-8
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,33 @@ yourself, [this tutorial][4] might be a good start._
6060

6161
[4]: https://www.analyticsmania.com/post/track-site-search-with-google-tag-manager-and-google-analytics/
6262

63+
### Cookie consent
64+
65+
[:octicons-file-code-24: Source][5] ·
66+
:octicons-beaker-24: Experimental ·
67+
[:octicons-heart-fill-24:{ .mdx-heart } Insiders only][5]{ .mdx-insiders }
68+
69+
Material for MkDocs ships a native and extensible cookie consent form, which
70+
when enabled will ask the user for his consent prior to sending analytics.
71+
Add the following to `mkdocs.yml`:
72+
73+
``` yaml
74+
extra:
75+
consent: true
76+
```
77+
78+
When a user first visits your site, a cookie consent form is rendered:
79+
80+
[![With tabs][6]][6]
81+
82+
[5]: ../insiders/index.md
83+
[6]: ../assets/screenshots/consent.png
84+
85+
_Let's get this feature out of the experimental status! You are encouraged to
86+
share your feedback in #1914, so we can provide the necessary configuration
87+
options for easy customizations. If you wish to customize it today, you can
88+
override_ `partials/consent.html`.
89+
6390
## Customization
6491

6592
### Other analytics providers
@@ -68,19 +95,19 @@ yourself, [this tutorial][4] might be a good start._
6895
:octicons-mortar-board-24: Difficulty: _easy_
6996

7097
In order to integrate another analytics service provider offering an
71-
asynchronous JavaScript-based tracking solution, you can [extend the theme][5]
72-
and [override the `analytics` block][6]:
98+
asynchronous JavaScript-based tracking solution, you can [extend the theme][7]
99+
and [override the `analytics` block][8]:
73100

74101
``` html
75102
{% block analytics %}
76103
<!-- Add custom analytics integration here -->
77104
{% endblock %}
78105
```
79106

80-
[5]: ../customization.md#extending-the-theme
81-
[6]: ../customization.md#overriding-blocks-recommended
107+
[7]: ../customization.md#extending-the-theme
108+
[8]: ../customization.md#overriding-blocks-recommended
82109

83-
If you're using [instant loading][7], you may use the `location$` observable,
110+
If you're using [instant loading][9], you may use the `location$` observable,
84111
which will emit the current `URL` to listen for navigation events and register
85112
a page view event with:
86113

@@ -90,9 +117,9 @@ location$.subscribe(function(url) {
90117
})
91118
```
92119

93-
Note that this must be integrated with [additional JavaScript][8], and cannot be
120+
Note that this must be integrated with [additional JavaScript][10], and cannot be
94121
included as part of the `analytics` block, as it is included in the `head` of
95122
the document.
96123

97-
[7]: setting-up-navigation.md#instant-loading
98-
[8]: ../customization.md#additional-javascript
124+
[9]: setting-up-navigation.md#instant-loading
125+
[10]: ../customization.md#additional-javascript

material/assets/stylesheets/main.1fe995fd.min.css

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

material/assets/stylesheets/main.1fe995fd.min.css.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

material/assets/stylesheets/main.e1d16808.min.css

-2
This file was deleted.

material/assets/stylesheets/main.e1d16808.min.css.map

-1
This file was deleted.

material/base.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
{% endif %}
4040
{% endblock %}
4141
{% block styles %}
42-
<link rel="stylesheet" href="{{ 'assets/stylesheets/main.e1d16808.min.css' | url }}">
42+
<link rel="stylesheet" href="{{ 'assets/stylesheets/main.1fe995fd.min.css' | url }}">
4343
{% if config.theme.palette %}
4444
{% set palette = config.theme.palette %}
4545
<link rel="stylesheet" href="{{ 'assets/stylesheets/palette.f1a3b89f.min.css' | url }}">

src/assets/stylesheets/main/layout/_form.scss

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
font-weight: 700;
3636
border: px2rem(2px) solid currentColor;
3737
border-radius: px2rem(2px);
38+
cursor: pointer;
3839
transition:
3940
color 125ms,
4041
background-color 125ms,

0 commit comments

Comments
 (0)