summaryrefslogtreecommitdiff
path: root/layouts/_default/baseof.html
blob: 99f09d9dc01de84b83f4014a3a7dd58d73c8131f (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
<!DOCTYPE html>
<html lang="{{ .Language.LanguageCode }}" dir="{{ .Language.LanguageDirection | default "ltr" }}">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>{{ block "title" . }}{{ if and (not .IsHome) .Title }}{{ .Title }} | {{ end }}{{ site.Title }}{{ end }}</title>

        {{- with .Description }}
            <meta name="description" content="{{ . }}">
        {{- else }}
            {{- if or .IsPage .IsSection}}
                <meta name="description" content="{{ .Summary | plainify | default (printf "%s | %s" .Title site.Title) }}">
            {{- else }}
                <meta name="description" content="{{ site.Params.description | default site.Title }}">
            {{- end }}
        {{- end }}

        <meta name="generator" content="Hugo {{ hugo.Version }}">
        <link rel="canonical" href="{{ .Permalink }}">

        {{- if .IsTranslated }}
            {{- range .Translations }}
                <link rel="alternate" hreflang="{{ .Lang }}" href="{{ .Permalink }}">
            {{- end }}
        {{- end }}

        {{- with .OutputFormats.Get "rss" }}
            {{- printf `<link rel=%q type=%q href=%q title=%q>` .Rel .MediaType.Type .Permalink site.Title | safeHTML }}
        {{- end }}

        {{- partial "head/meta.html" . }}
        {{- partial "head/seo.html" . }}
        <!-- Prevent FOUC, default light mode -->
        <script>
            const storedTheme = localStorage.getItem("theme");
            const prefDarkmode = window.matchMedia("(prefers-color-scheme: dark)").matches;
            document.documentElement.setAttribute("data-theme", storedTheme ?? (prefDarkmode ? "dark" : "light"));
        </script>
        {{- partialCached "head/css.html" . }}
        {{ partialCached "head/js.html" . }}
    </head>

    <body class="{{ .Type | default "page" }}">
        {{ partial "header.html" . }}
        {{ partial "navmenu.html" (dict "menuID" "main" "page" .) }}

        <main id="main-content" class="site__main" role="main">
            {{ block "main" . }}{{ end }}
        </main>

        {{ partial "footer.html" . }}
    </body>
</html>