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

baseof.html « _default « layouts - github.com/dillonzq/LoveIt.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: dbc854bfbdf1a7d83afab9cb7adc5337d1fecf16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
{{- $version := "0.2.X" -}}

{{- /* LoveIt theme version detection */ -}}
{{- if eq .Site .Sites.First -}}
    {{- if not .Site.Params.version -}}
        {{- errorf "Configuration Error 配置文件错误\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 $version -}}
        {{- errorf (printf "Compatibility Error 兼容性错误\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 -}}
{{- end -}}

{{- $params := .Params | merge .Site.Params.page -}}
{{- .Scratch.Set "version" "0.2.3" -}}

{{- if eq hugo.Environment "production" -}}
    {{- .Scratch.Set "cdn" .Site.Params.cdn -}}
    {{- .Scratch.Set "fingerprint" .Site.Params.fingerprint -}}
    {{- .Scratch.Set "analytics" .Site.Params.analytics -}}
    {{- .Scratch.Set "comment" $params.comment -}}
{{- else if eq .Site .Sites.First -}}
    {{- warnf "\n\nCurrent environment is \"development\". The \"comment system\", \"CDN\" and \"fingerprint\" will be disabled.\n当前运行环境是 \"development\". \"评论系统\", \"CDN\" 和 \"fingerprint\" 不会启用.\n" -}}
{{- 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>
        <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 */ -}}
        {{- $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.setAttribute('theme', 'dark');</script>

        <div id="mask"></div>

        {{- /* 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-buttons">
            {{- /* top button */ -}}
            <a href="#" id="back-to-top" class="fixed-button" title="{{ T `backToTop` }}">
                <i class="fas fa-arrow-up fa-fw"></i>
            </a>

            {{- /* comment button */ -}}
            <a href="#" id="view-comments" class="fixed-button" title="{{ T `viewComments` }}">
                <i class="fas fa-comment fa-fw"></i>
            </a>
        </div>

        {{- /* Load JavaScript scripts and CSS */ -}}
        {{- partial "assets.html" . -}}
    </body>
</html>