Skip to content

Commit

Permalink
Enable new mkdocs-material features (#2451)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaharagon committed Apr 3, 2024
1 parent 04c37b9 commit 5f0605e
Show file tree
Hide file tree
Showing 13 changed files with 271 additions and 222 deletions.
408 changes: 225 additions & 183 deletions Pipfile.lock

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion config/mkdocs-common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ site_description:
]
copyright:
!ENV [FOOTER_COPYRIGHT, "© 2019 Privacy Guides and contributors."]
edit_uri: edit/main/docs/
edit_uri_template: blob/main/docs/{path}?plain=1

extra:
generator: false
Expand Down Expand Up @@ -152,6 +152,11 @@ theme:
- navigation.expand
- navigation.path
- navigation.indexes
- navigation.instant
- navigation.instant.prefetch
- navigation.instant.progress
- navigation.instant.preview
- content.action.edit
- content.tabs.link
- content.tooltips
- search.highlight
Expand Down
2 changes: 1 addition & 1 deletion config/mkdocs.es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ docs_dir: "../i18n/es"
site_url: "https://www.privacyguides.org/es/"
site_dir: "../site/es"

edit_uri: edit/main/i18n/es/
edit_uri_template: https://github.com/privacyguides/i18n/blob/main/i18n/es/{path}?plain=1

theme:
language: es
Expand Down
2 changes: 1 addition & 1 deletion config/mkdocs.fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ docs_dir: "../i18n/fr"
site_url: "https://www.privacyguides.org/fr/"
site_dir: "../site/fr"

edit_uri: edit/main/i18n/fr/
edit_uri_template: https://github.com/privacyguides/i18n/blob/main/i18n/fr/{path}?plain=1

theme:
language: fr
Expand Down
2 changes: 1 addition & 1 deletion config/mkdocs.he.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ docs_dir: "../i18n/he"
site_url: "https://www.privacyguides.org/he/"
site_dir: "../site/he"

edit_uri: edit/main/i18n/he/
edit_uri_template: https://github.com/privacyguides/i18n/blob/main/i18n/he/{path}?plain=1

extra_css:
- assets/stylesheets/extra.css?v=3.2.0
Expand Down
2 changes: 1 addition & 1 deletion config/mkdocs.it.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ docs_dir: "../i18n/it"
site_url: "https://www.privacyguides.org/it/"
site_dir: "../site/it"

edit_uri: edit/main/i18n/it/
edit_uri_template: https://github.com/privacyguides/i18n/blob/main/i18n/it/{path}?plain=1

theme:
language: it
Expand Down
2 changes: 1 addition & 1 deletion config/mkdocs.nl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ docs_dir: "../i18n/nl"
site_url: "https://www.privacyguides.org/nl/"
site_dir: "../site/nl"

edit_uri: edit/main/i18n/nl/
edit_uri_template: https://github.com/privacyguides/i18n/blob/main/i18n/nl/{path}?plain=1

theme:
language: nl
Expand Down
2 changes: 1 addition & 1 deletion config/mkdocs.ru.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ docs_dir: "../i18n/ru"
site_url: "https://www.privacyguides.org/ru/"
site_dir: "../site/ru"

edit_uri: edit/main/docs/
edit_uri_template: https://github.com/privacyguides/i18n/blob/main/i18n/ru/{path}?plain=1

extra_css:
- assets/stylesheets/extra.css?v=3.2.0
Expand Down
2 changes: 1 addition & 1 deletion config/mkdocs.zh-Hant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ docs_dir: "../i18n/zh-Hant"
site_url: "https://www.privacyguides.org/zh-Hant/"
site_dir: "../site/zh-Hant"

edit_uri: edit/main/i18n/zh-Hant/
edit_uri_template: https://github.com/privacyguides/i18n/blob/main/i18n/zh-Hant/{path}?plain=1

extra_css:
- assets/stylesheets/extra.css?v=3.2.0
Expand Down
2 changes: 1 addition & 1 deletion modules/mkdocs-material
12 changes: 1 addition & 11 deletions netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,9 @@
X-XSS-Protection = "0"
X-Content-Type-Options = "nosniff"
Strict-Transport-Security = "max-age=63072000; includeSubDomains; preload"
Content-Security-Policy = "default-src 'none'; script-src https://www.privacyguides.org 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; font-src 'self' data:; img-src data: 'self'; connect-src https://api.github.com https://*.privacyguides.net 'self'; frame-src https://*.privacyguides.net; frame-ancestors 'none'"
Content-Security-Policy = "default-src 'none'; script-src https://www.privacyguides.org 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; font-src 'self' data:; img-src data: 'self'; connect-src https://api.github.com https://*.privacyguides.net https://www.privacyguides.org 'self'; frame-src https://*.privacyguides.net https://snowflake.torproject.org; frame-ancestors 'none'"
Permissions-Policy = "browsing-topics=(), conversion-measurement=(), interest-cohort=(), accelerometer=(), ambient-light-sensor=(), battery=(), camera=(), display-capture=(), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), usb=()"

[[headers]]
for = "/:lang/about/donate/"
[headers.values]
Content-Security-Policy = "default-src 'none'; script-src https://opencollective.com https://www.privacyguides.org 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; font-src 'self' data:; img-src https://opencollective.com data: 'self'; connect-src https://api.github.com https://*.privacyguides.net 'self'; frame-src https://opencollective.com; frame-ancestors 'none'"

[[headers]]
for = "/:lang/tor/"
[headers.values]
Content-Security-Policy = "default-src 'none'; script-src https://www.privacyguides.org 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; font-src 'self' data:; img-src data: 'self'; connect-src https://api.github.com https://*.privacyguides.net 'self'; frame-src https://snowflake.torproject.org; frame-ancestors 'none'"

[[redirects]]
from = "/es/*"
to = "/i18n/404.es.html"
Expand Down
21 changes: 2 additions & 19 deletions theme/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,24 +69,7 @@
<title>{{ config.site_name }}</title>
{% endif %}
{% endblock %}
{% block announce %}{% if config.extra.offline %}
You're viewing an offline copy of Privacy Guides built on {{ build_date_utc }}.
<a href="https://www.privacyguides.org/">
<strong>Visit privacyguides.org for the latest version.</strong>
</a>
{% elif config.extra.context == "deploy-preview" %}
You're viewing an <strong>unreviewed preview</strong> of Privacy Guides built on {{ build_date_utc }}.
These previews are <strong>user-submitted</strong> and may not necessarily reflect the opinion of the site.
<a href="https://www.privacyguides.org/">
<strong>Visit privacyguides.org for current advice.</strong>
</a>
{% elif config.extra.context == "branch-deploy" %}
You're viewing a <strong>staging branch</strong> of Privacy Guides built on {{ build_date_utc }}.
The information on this page may be incomplete or otherwise not yet meet our editorial release standards.
<a href="https://www.privacyguides.org/">
<strong>Visit privacyguides.org for current advice.</strong>
</a>
{% else %}{% endif %}{% endblock %}

{% block extrahead %}
<meta name="robots" content="max-snippet:-1, max-image-preview:large">
{% if config.extra.context == "production" %}
Expand All @@ -102,8 +85,8 @@
{% block content %}
{% if page and page.meta and page.meta.cover %}
<div class="center-cropped" style="background-image:linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), url('/en/assets/img/cover/{{ page.meta.cover }}');">
<h1>{{ page.title | d(config.site_name, true)}}</h1>
<img src="/en/assets/img/cover/{{ page.meta.cover }}" alt="">
<h1>{{ page.title | d(config.site_name, true)}}</h1>
</div>
{% endif %}
{% if "material/tags" in config.plugins %}
Expand Down
29 changes: 29 additions & 0 deletions theme/partials/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,35 @@
IN THE SOFTWARE.
-->

{% macro notice() %}{% if config.extra.offline %}
You're viewing an offline copy of Privacy Guides built on {{ build_date_utc.strftime('%B %d, %Y at %I:%M%p') }}.
<a href="https://www.privacyguides.org/">
<strong>Visit privacyguides.org for the latest version.</strong>
</a>
{% elif config.extra.context == "deploy-preview" %}
You're viewing an <strong>unreviewed preview</strong> of Privacy Guides built on {{ build_date_utc.strftime('%B %d, %Y at %I:%M%p') }}.
These previews are <strong>user-submitted</strong> and may not necessarily reflect the opinion of the site.
<a href="https://www.privacyguides.org/">
<strong>Visit privacyguides.org for current advice.</strong>
</a>
{% elif config.extra.context == "branch-deploy" %}
You're viewing a <strong>staging branch</strong> of Privacy Guides built on {{ build_date_utc.strftime('%B %d, %Y at %I:%M%p') }}.
The information on this page may be incomplete or otherwise not yet meet our editorial release standards.
<a href="https://www.privacyguides.org/">
<strong>Visit privacyguides.org for current advice.</strong>
</a>
{% else %}{% endif %}{% endmacro %}

{% if notice() %}
<div data-md-color-scheme="default" data-md-component="outdated">
<aside class="md-banner md-banner--warning">
<div class="md-banner__inner md-grid md-typeset">
{{ notice() }}
</div>
</aside>
</div>
{% endif %}

<!-- Determine classes -->
{% set class = "md-header" %}
{% if "navigation.tabs.sticky" in features %}
Expand Down

0 comments on commit 5f0605e

Please sign in to comment.