Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/uPagge/uBlogger.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDillon <dillonzq@outlook.com>2020-04-21 17:55:06 +0300
committerGitHub <noreply@github.com>2020-04-21 17:55:06 +0300
commitf14301c395ffd63ef72625bf8bfe887fa211d013 (patch)
tree367e8f5a699a0b1df5d142f0ae259c9d6dd9de3f /layouts/_default/baseof.html
parent8a0e61085cfc2f2d1a342697c73b10cbc1d27a68 (diff)
feat: improve configuration (#245)
* feat: improve configuration * fix: fix partials/footer.html error
Diffstat (limited to 'layouts/_default/baseof.html')
-rw-r--r--layouts/_default/baseof.html34
1 files changed, 20 insertions, 14 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index fb97d56..0862dfc 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -1,20 +1,26 @@
-{{- $scratch := newScratch -}}
-{{- .Scratch.Set "scratch" $scratch -}}
-{{- if eq hugo.Environment "production" -}}
- {{- $scratch.Set "CDN" .Site.Params.cdn -}}
- {{- $scratch.Set "fingerprint" .Site.Params.fingerprint -}}
-{{- end -}}
-
-{{- $scratch.Set "major-version" "0.2.X" -}}
-{{- $scratch.Set "version" "0.2.0" -}}
+{{- $version := "0.2.X" -}}
{{- /* LoveIt theme version detection */ -}}
{{- if not .Site.Params.version -}}
{{- errorf "\n\nYou haven't configured the LoveIt version param correctly yet. See https://hugoloveit.com/theme-documentation-basics/#basic-configuration \n你还没有正确配置 LoveIt 的版本参数 参考 https://hugoloveit.com/zh-cn/theme-documentation-basics/#basic-configuration \n" -}}
-{{- else if ne .Site.Params.version ($scratch.Get "major-version") -}}
- {{- errorf (printf "\n\n%s -> %s:\nYou have an incompatible update. See https://github.com/dillonzq/LoveIt/releases \n你进行了一次不兼容的更新 参考 https://github.com/dillonzq/LoveIt/releases \n" .Site.Params.version ($scratch.Get "major-version")) -}}
+{{- else if ne .Site.Params.version $version -}}
+ {{- errorf (printf "\n\n%s -> %s:\nYou have an incompatible update. See https://github.com/dillonzq/LoveIt/releases \n你进行了一次不兼容的更新 参考 https://github.com/dillonzq/LoveIt/releases \n" .Site.Params.version $version) -}}
+{{- end -}}
+
+{{- $params := .Params | merge .Site.Params.page -}}
+{{- .Scratch.Set "version" "0.2.0" -}}
+
+{{- if eq hugo.Environment "production" -}}
+ {{- .Scratch.Set "cdn" .Site.Params.cdn -}}
+ {{- .Scratch.Set "fingerprint" .Site.Params.fingerprint -}}
+{{- else -}}
+ {{- $params = dict "comment" nil | merge $params -}}
{{- end -}}
+{{- .Scratch.Set "params" $params -}}
+{{- $this := dict "desktop" .Site.Params.header.desktopMode "mobile" .Site.Params.header.mobileMode | dict "headerMode" | dict "config" -}}
+{{- .Scratch.Set "this" $this -}}
+
<!DOCTYPE html>
<html lang="{{ .Site.LanguageCode }}">
<head>
@@ -25,7 +31,7 @@
<title>
{{- block "title" . }}{{ .Site.Title }}{{ end -}}
</title>
- <meta name="Description" content="{{ .Params.description | default .Site.Params.description }}">
+ <meta name="Description" content="{{ $params.description | default .Site.Params.description }}">
{{- partial "head/meta.html" . -}}
{{- partial "head/link.html" . -}}
@@ -33,8 +39,8 @@
</head>
<body>
{{- /* Check theme isDark before body rendering */ -}}
- {{- $theme := .Site.Params.defaultTheme -}}
- <script type="text/javascript">(window.localStorage && localStorage.getItem('theme') ? localStorage.getItem('theme') === 'dark' : ('{{ .Site.Params.defaultTheme }}' === 'auto' ? window.matchMedia('(prefers-color-scheme: dark)').matches : '{{ .Site.Params.defaultTheme }}' === 'dark')) && document.body.classList.add('dark');</script>
+ {{- $theme := .Site.Params.defaulttheme -}}
+ <script type="text/javascript">(window.localStorage && localStorage.getItem('theme') ? localStorage.getItem('theme') === 'dark' : ('{{ $theme }}' === 'auto' ? window.matchMedia('(prefers-color-scheme: dark)').matches : '{{ $theme }}' === 'dark')) && document.body.classList.add('dark');</script>
<div id="mask"></div>