header.html 4.3 KB
Newer Older
D
Dillon 已提交
1
{{- /* Desktop header */ -}}
2
<header class="desktop" id="header-desktop">
D
Dillon 已提交
3 4
    <div class="header-wrapper">
        <div class="header-title animated bounceIn">
5
            <a href="{{ `/` | relLangURL }}">
D
Dillon 已提交
6 7
                {{- .Site.Title -}}
            </a>
G
Giuseppe Pignataro 已提交
8
        </div>
D
Dillon 已提交
9
        <div class="menu">
D
Dillon 已提交
10
            {{- range .Site.Menus.main -}}
D
Dillon 已提交
11
                <a class="menu-item{{ if $.IsMenuCurrent "main" . | or ($.HasMenuCurrent "main" .) | or (.URL | relLangURL | string | eq $.RelPermalink ) }} active{{ end }}" href="{{ .URL | relLangURL }}"{{ with .Title }} title="{{ . }}"{{ end }}>
D
Dillon 已提交
12
                    {{- .Pre | safeHTML }}{{ .Name -}}
D
Dillon 已提交
13 14
                </a>
            {{- end -}}
D
Dillon 已提交
15 16
            {{- if .Site.IsMultiLingual -}}
                &nbsp;|&nbsp;
17
                <a href="javascript:void(0);" class="menu-item" title="{{ T "selectLanguage" }}">
D
Dillon 已提交
18 19 20 21 22 23 24 25 26 27
                    <i class="fas fa-language fa-fw"></i>&nbsp;
                    <select class="language-select" onchange="location = this.value;">
                        {{- range .Page.AllTranslations -}}
                            {{- $translation := . -}}
                            {{- range $.Site.Languages -}}
                                {{- if eq $translation.Lang .Lang -}}
                                    {{- if eq $.Page.Lang .Lang -}}
                                        <option value="{{ $translation.RelPermalink }}" selected>{{ .LanguageName }}</option>
                                    {{- else -}}
                                        <option value="{{ $translation.RelPermalink }}">{{ .LanguageName }}</option>
D
Dillon 已提交
28 29 30
                                    {{- end -}}
                                {{- end -}}
                            {{- end -}}
D
Dillon 已提交
31 32
                        {{- end -}}
                    </select>
33
                </a>
D
Dillon 已提交
34
            {{- end -}}
35
            <a href="javascript:void(0);" class="theme-switch" title="{{ T "switchTheme" }}">
36
                <i class="fas fa-adjust fa-fw "></i>
37
            </a>
G
Giuseppe Pignataro 已提交
38 39
        </div>
    </div>
D
Dillon 已提交
40
</header>
D
Dillon 已提交
41

D
Dillon 已提交
42
{{- /* Mobile header */ -}}
43
<header class="mobile" id="header-mobile">
D
Dillon 已提交
44 45 46
    <div class="header-wrapper">
        <div class="header-container">
            <div class="header-title animated bounceIn">
47
                <a href="{{ `/` | relLangURL }}">
D
Dillon 已提交
48 49
                    {{- .Site.Title -}}
                </a>
50
            </div>
D
Dillon 已提交
51
            <div class="menu-toggle" id="menu-toggle-mobile">
G
Giuseppe Pignataro 已提交
52 53 54
                <span></span><span></span><span></span>
            </div>
        </div>
D
Dillon 已提交
55
        <div class="menu" id="menu-mobile">
D
Dillon 已提交
56 57
            {{- $currentPage := . -}}
            {{- range .Site.Menus.main -}}
D
Dillon 已提交
58
                <a class="menu-item" href="{{ .URL | relLangURL }}" title="{{ .Title }}">
D
Dillon 已提交
59
                    {{- .Pre | safeHTML }}{{ .Name -}}
D
Dillon 已提交
60 61
                </a>
            {{- end -}}
D
Dillon 已提交
62
            {{- if .Site.IsMultiLingual -}}
63
                <a href="javascript:void(0);" class="menu-item" title="{{ T "selectLanguage" }}">
D
Dillon 已提交
64 65 66 67 68 69 70 71 72 73
                    <i class="fas fa-language fa-fw"></i>&nbsp;
                    <select class="language-select" onchange="location = this.value;">
                        {{- range .Page.AllTranslations -}}
                            {{- $translation := . -}}
                            {{- range $.Site.Languages -}}
                                {{- if eq $translation.Lang .Lang -}}
                                    {{- if eq $.Page.Lang .Lang -}}
                                        <option value="{{ $translation.RelPermalink }}" selected>{{ .LanguageName }}</option>
                                    {{- else -}}
                                        <option value="{{ $translation.RelPermalink }}">{{ .LanguageName }}</option>
D
Dillon 已提交
74 75 76
                                    {{- end -}}
                                {{- end -}}
                            {{- end -}}
D
Dillon 已提交
77 78
                        {{- end -}}
                    </select>
79
                </a>
D
Dillon 已提交
80
            {{- end -}}
81
            <a href="javascript:void(0);" class="theme-switch" title="{{ T "switchTheme" }}">
82
                <i class="fas fa-adjust fa-fw"></i>
83
            </a>
G
Giuseppe Pignataro 已提交
84 85
        </div>
    </div>
D
Dillon 已提交
86
</header>
D
Dillon 已提交
87 88

<script>
89 90
    window.desktopHeaderMode = {{ .Site.Params.header.desktopMode }};
    window.mobileHeaderMode = {{ .Site.Params.header.mobileMode }};
D
Dillon 已提交
91
</script>