From 0bcd8414d5f01f75cbc0b986cd6f57b23e03b82c Mon Sep 17 00:00:00 2001 From: gribse Date: Fri, 18 Apr 2025 13:29:14 +0200 Subject: [PATCH] Add theme toggle functionality and update CSS inclusion in home layout --- layouts/home.html | 154 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 131 insertions(+), 23 deletions(-) diff --git a/layouts/home.html b/layouts/home.html index 5cf3509..8dc865d 100644 --- a/layouts/home.html +++ b/layouts/home.html @@ -3,6 +3,21 @@ + + + + + + + + {{- $theme_vars := (resources.Get "css/core/theme-vars.css") }} + {{- $reset := (resources.Get "css/core/reset.css") }} + {{- $media := (resources.Get "css/core/zmedia.css") }} + {{- $license_css := (resources.Get "css/core/license.css") }} + {{- $common := (resources.Match "css/common/*.css") | resources.Concat "assets/css/common.css" }} + {{- $core := (slice $theme_vars $reset $common $media) | resources.Concat "assets/css/core.css" | resources.Minify }} + + +
+ + {{- /* theme-toggle is enabled */}} + {{- if (not site.Params.disableThemeToggle) }} + {{- /* theme is light */}} + {{- if (eq site.Params.defaultTheme "light") }} + + {{- /* theme is dark */}} + {{- else if (eq site.Params.defaultTheme "dark") }} + + {{- else }} + {{- /* theme is auto */}} + + {{- end }} + {{- /* theme-toggle is disabled and theme is auto */}} + {{- else if (and (ne site.Params.defaultTheme "light") (ne site.Params.defaultTheme "dark"))}} + + {{- end }} + + + +
+ + +
-
- {{ partial "posts-defile.html" (dict "context" . "direction" "up") }} -
-
-

{{ .Title }}

- {{ .Content }} -
- - Work icon by Shar - Blog - - - Work icon by Shar - Recettes - - - Work icon by Shar - Livres - +
+ {{ partial "posts-defile.html" (dict "context" . "direction" "up") }} +
+
+

{{ .Title }}

+ + {{- if (not site.Params.disableThemeToggle) }} + + {{- end }} + + + {{ .Content }} + +
+
+ {{ partial "posts-defile.html" (dict "context" . "direction" "down") }}
-
-
- {{ partial "posts-defile.html" (dict "context" . "direction" "down") }} -
+ + +