diff --git a/assets/js/theme.js b/assets/js/theme.js index 930f638..20c9758 100644 --- a/assets/js/theme.js +++ b/assets/js/theme.js @@ -14,11 +14,13 @@ if (theme !== null) { themeToggle.addEventListener("click", () => { document.body.classList.toggle("dark-theme"); + window.localStorage && window.localStorage.setItem( "theme", document.body.classList.contains("dark-theme") ? "dark" : "light" ); + document.body.classList.contains("dark-theme") ? metaThemeColor.setAttribute("content", "#252627") : metaThemeColor.setAttribute("content", "#fafafa"); diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 5ef07d5..d797bb6 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -62,7 +62,7 @@ disableHugoGeneratorInject = false homeSubtitle = "Hello Friend NG" # Set a background for the homepage - # background_image = "assets/images/background.jpg" + # backgroundImage = "assets/images/background.jpg" # Prefix of link to the git commit detail page. GitInfo must be enabled. # diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index ec42a61..4f6d2e5 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -5,8 +5,9 @@ {{ block "body" . }} -
+ {{ end }} +