mirror of
https://github.com/dillonzq/LoveIt.git
synced 2024-11-15 03:16:30 +01:00
41c2d3a38e
* feat: add detection of the theme version and Hugo version * fix: hugo.IsProduction is incompatible in Hugo v0.62.0
71 lines
3 KiB
HTML
71 lines
3 KiB
HTML
{{- $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" -}}
|
|
|
|
{{- /* 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")) -}}
|
|
{{- end -}}
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="{{ .Site.LanguageCode }}">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<meta name="robots" content="noodp" />
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
|
|
<title>
|
|
{{- block "title" . }}{{ .Site.Title }}{{ end -}}
|
|
</title>
|
|
<meta name="Description" content="{{ .Params.description | default .Site.Params.description }}">
|
|
|
|
{{- partial "head/meta.html" . -}}
|
|
{{- partial "head/link.html" . -}}
|
|
{{- partial "head/seo.html" . -}}
|
|
</head>
|
|
<body>
|
|
{{- /* Check theme isDark before body rendering */ -}}
|
|
<script>
|
|
if (!window.localStorage || !window.localStorage.getItem('theme')) {
|
|
{{- $theme := .Site.Params.defaultTheme -}}
|
|
{{- if eq $theme "auto" -}}
|
|
window.isDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
{{- else -}}
|
|
window.isDark = '{{ $theme }}' === 'dark';
|
|
{{- end -}}
|
|
} else {
|
|
window.isDark = (window.localStorage && window.localStorage.getItem('theme')) === 'dark';
|
|
}
|
|
window.isDark && document.body.classList.add('dark-theme');
|
|
</script>
|
|
|
|
{{- /* Body wrapper */ -}}
|
|
<div class="wrapper">
|
|
{{- partial "header.html" . -}}
|
|
<main class="main">
|
|
<div class="container">
|
|
{{- block "content" . }}{{ end -}}
|
|
</div>
|
|
</main>
|
|
{{- partial "footer.html" . -}}
|
|
</div>
|
|
|
|
<div id="fixed-btn-container">
|
|
{{- /* top button */ -}}
|
|
<a href="#" id="top-button" class="fixed-button animated faster">
|
|
<i class="fas fa-arrow-up fa-fw"></i>
|
|
</a>
|
|
</div>
|
|
|
|
{{- /* Load JavaScript scripts and CSS */ -}}
|
|
{{- partial "assets.html" . -}}
|
|
</body>
|
|
</html>
|