From d549a90e481b0080991a056792c4636ba8c45ece Mon Sep 17 00:00:00 2001 From: Djordje Atlialp Date: Sun, 10 Jan 2021 18:09:12 +0100 Subject: [PATCH] Overwork background image support --- assets/js/theme.js | 2 ++ exampleSite/config.toml | 2 +- layouts/_default/baseof.html | 3 ++- layouts/index.html | 4 +--- layouts/partials/footer.html | 8 ++------ 5 files changed, 8 insertions(+), 11 deletions(-) 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 }} +
{{ partial "header.html" . }} diff --git a/layouts/index.html b/layouts/index.html index b7ee112..a9399d6 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,7 +1,5 @@ {{ define "body" }} - + {{ end }} {{ define "main" }} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 85a1f91..857104b 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -2,12 +2,8 @@