From a9e00a3640b5d98e6fce03dc5c67e87e3fac916d Mon Sep 17 00:00:00 2001 From: Aditya Telange <21258296+adityatelange@users.noreply.github.com> Date: Mon, 5 Oct 2020 14:33:48 +0530 Subject: [PATCH] theme: set proper conditions for having default-theme with theme-toggle * can set/unset default theme * for default-theme: dark/light : theme-toggle will not be visible * theme-toggle with defaultheme: auto is functional fixes #25 for #15 --- layouts/partials/footer.html | 4 ++-- layouts/partials/header.html | 11 +++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index d7e9166..1c28f3a 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -49,7 +49,7 @@ localStorage.setItem("menu-scroll-position", document.getElementById('menu').scrollLeft); } -{{- if not .Site.Params.disableThemeToggle }} +{{- if (and (not .Site.Params.disableThemeToggle) (not (or (eq .Site.Params.defaultTheme "light") (eq .Site.Params.defaultTheme "dark")))) }} -{{- end }} +{{- end }} \ No newline at end of file diff --git a/layouts/partials/header.html b/layouts/partials/header.html index f67f33b..40e7b15 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -1,4 +1,4 @@ -{{- if eq .Site.Params.defaultTheme "auto" }} +{{- if (and (not .Site.Params.disableThemeToggle) (not (or (eq .Site.Params.defaultTheme "light") (eq .Site.Params.defaultTheme "dark")))) }} {{- end }} +{{- if (and (.Site.Params.disableThemeToggle) (eq .Site.Params.defaultTheme "auto")) }} + +{{- end }}