From a6a37ab9d08fcbbd5e5050fb04cdd32cd74f1f7b Mon Sep 17 00:00:00 2001 From: Sigurd Spieckermann <2206639+sisp@users.noreply.github.com> Date: Mon, 21 Aug 2023 18:08:46 +0200 Subject: [PATCH] Moved header options to partials (#5877) * Improved warning in social plugin about site_url * Documentation * Documentation * Extract header options into partials --------- Co-authored-by: squidfunk --- docs/customization.md | 2 ++ material/partials/alternate.html | 22 ++++++++++++ material/partials/header.html | 34 ++---------------- material/partials/palette.html | 16 +++++++++ src/partials/alternate.html | 48 +++++++++++++++++++++++++ src/partials/header.html | 60 ++------------------------------ src/partials/palette.html | 54 ++++++++++++++++++++++++++++ 7 files changed, 146 insertions(+), 90 deletions(-) create mode 100644 material/partials/alternate.html create mode 100644 material/partials/palette.html create mode 100644 src/partials/alternate.html create mode 100644 src/partials/palette.html diff --git a/docs/customization.md b/docs/customization.md index b52797dcd..34b28d497 100644 --- a/docs/customization.md +++ b/docs/customization.md @@ -100,6 +100,7 @@ assets may also be put in the `overrides` directory: │ │ └─ analytics.html # Analytics setup │ ├─ languages/ # Translation languages │ ├─ actions.html # Actions +│ ├─ alternate.html # Translation language selector │ ├─ comments.html # Comment system (empty by default) │ ├─ consent.html # Consent │ ├─ content.html # Page content @@ -113,6 +114,7 @@ assets may also be put in the `overrides` directory: │ ├─ nav.html # Main navigation │ ├─ nav-item.html # Main navigation item │ ├─ pagination.html # Pagination (used for blog) +│ ├─ palette.html # Color palette toggle │ ├─ post.html # Blog post excerpt │ ├─ search.html # Search interface │ ├─ social.html # Social links diff --git a/material/partials/alternate.html b/material/partials/alternate.html new file mode 100644 index 000000000..4492d6576 --- /dev/null +++ b/material/partials/alternate.html @@ -0,0 +1,22 @@ +{#- + This file was automatically generated - do not edit +-#} +
+
+ {% set icon = config.theme.icon.alternate or "material/translate" %} + +
+ +
+
+
diff --git a/material/partials/header.html b/material/partials/header.html index f35aa254c..86311ad30 100644 --- a/material/partials/header.html +++ b/material/partials/header.html @@ -36,41 +36,11 @@ {% if config.theme.palette %} {% if not config.theme.palette is mapping %} -
- {% for option in config.theme.palette %} - {% set scheme = option.scheme | d("default", true) %} - {% set primary = option.primary | d("indigo", true) %} - {% set accent = option.accent | d("indigo", true) %} - - {% if option.toggle %} - - {% endif %} - {% endfor %} -
+ {% include "partials/palette.html" %} {% endif %} {% endif %} {% if config.extra.alternate %} -
-
- {% set icon = config.theme.icon.alternate or "material/translate" %} - -
- -
-
-
+ {% include "partials/alternate.html" %} {% endif %} {% if "material/search" in config.plugins %}