Overwork background image support

This commit is contained in:
Djordje Atlialp 2021-01-10 18:09:12 +01:00
parent 24b4615f73
commit d549a90e48
5 changed files with 8 additions and 11 deletions

View file

@ -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");

View file

@ -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.
#

View file

@ -5,8 +5,9 @@
</head>
{{ block "body" . }}
<body class="{{ if ne $.Site.Params.defaultTheme "light" -}} dark-theme {{- end -}}">
<body class="{{ if ne $.Site.Params.defaultTheme "light" -}} dark-theme {{- end -}}">
{{ end }}
<div class="container">
{{ partial "header.html" . }}

View file

@ -1,7 +1,5 @@
{{ define "body" }}
<body
class="{{ if ne $.Site.Params.defaultTheme "light" -}} dark-theme {{- end -}} {{ if .Site.Params.background_image }}background-image"
style="background-image: url('{{ .Site.Params.background_image }}');" {{ else }}"{{ end }}>
<body class="{{ if ne $.Site.Params.defaultTheme "light" -}} dark-theme {{- end -}} {{ if .Site.Params.background_image }} background-image" style="background-image: url('{{ .Site.Params.backgroundImage }}');" {{ else }}"{{ end }}>
{{ end }}
{{ define "main" }}

View file

@ -2,12 +2,8 @@
<div class="footer__inner">
<div class="footer__content">
<span>&copy; {{ now.Format "2006" }}</span>
{{ if .Site.Author.name }}
<span><a href="{{ .Site.BaseURL }}">{{ .Site.Author.name }}</a></span>
{{ end }}
{{ if .Site.Copyright }}
<span>{{ .Site.Copyright| safeHTML }}</span>
{{ end }}
{{ if .Site.Author.name }}<span><a href="{{ .Site.BaseURL }}">{{ .Site.Author.name }}</a></span>{{ end }}
{{ if .Site.Copyright }}<span>{{ .Site.Copyright| safeHTML }}</span>{{ end }}
{{- with (not (in (.Site.Language.Get "disableKinds") "RSS")) }}<span><a href="{{ "posts/index.xml" | absLangURL }}" target="_blank" title="rss"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-rss"><path d="M4 11a9 9 0 0 1 9 9"></path><path d="M4 4a16 16 0 0 1 16 16"></path><circle cx="5" cy="19" r="1"></circle></svg></a></span>{{ end }}
</div>
</div>