update theme-switcher functionality

This commit is contained in:
somrat sorkar 2023-12-09 08:52:04 +06:00
parent 32ba8bb3fb
commit 6892f7bf94
4 changed files with 7 additions and 7 deletions

View File

@ -1,7 +1,7 @@
#################### default parameters ################################ #################### default parameters ################################
# favicon # favicon module: https://github.com/gethugothemes/hugo-modules/tree/master/images#favicon-implementation
favicon = "images/favicon.png" favicon = "images/favicon.png"
# logo # logo module: https://github.com/gethugothemes/hugo-modules/tree/master/images#logo-implementation
logo = "images/logo.png" logo = "images/logo.png"
logo_darkmode = "images/logo-darkmode.png" logo_darkmode = "images/logo-darkmode.png"
# use `px` or `x` with logo_width, example: "100px". # use `px` or `x` with logo_width, example: "100px".
@ -16,7 +16,7 @@ logo_text = "Hugoplate"
navbar_fixed = true navbar_fixed = true
# theme-mode # theme-mode
theme_switcher = true theme_switcher = true
theme_default = "dark" # available options [light/dark/system] theme_default = "system" # available options [light/dark/system]
# Main Sections # Main Sections
mainSections = ["blog"] mainSections = ["blog"]
# contact form action # contact form action

View File

@ -1,6 +1,9 @@
<!doctype html> <!doctype html>
<html <html
itemscope itemscope
class="{{- if not site.Params.theme_switcher -}}
{{- site.Params.theme_default -}}
{{- end -}}"
lang="{{ site.LanguageCode | default `en-US` }}" lang="{{ site.LanguageCode | default `en-US` }}"
itemtype="http://schema.org/WebPage"> itemtype="http://schema.org/WebPage">
<head> <head>

View File

@ -34,7 +34,6 @@
</div> </div>
<!-- theme switcher --> <!-- theme switcher -->
{{ if site.Params.theme_switcher }}
<script> <script>
var darkMode = {{if eq site.Params.theme_default "dark"}}true{{else}}false{{end}}; var darkMode = {{if eq site.Params.theme_default "dark"}}true{{else}}false{{end}};
@ -61,5 +60,3 @@
}); });
</script> </script>
{{ end }} {{ end }}
{{ end }}

View File

@ -1,7 +1,7 @@
{ {
"name": "hugoplate", "name": "hugoplate",
"description": "hugo tailwindcss boilerplate", "description": "hugo tailwindcss boilerplate",
"version": "1.9.5", "version": "1.9.6",
"license": "MIT", "license": "MIT",
"author": "zeon.studio", "author": "zeon.studio",
"scripts": { "scripts": {