LoveIt/layouts/partials/header.html

93 lines
4.5 KiB
HTML

{{- /* Desktop header */ -}}
<header class="desktop" id="header-desktop">
<div class="header-wrapper">
<div class="header-title">
<a href="{{ `/` | relLangURL }}">
{{- .Site.Title -}}
</a>
</div>
<div class="menu">
{{- range .Site.Menus.main -}}
<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 }} rel="noopener noreffer"{{ if strings.HasPrefix .URL "http" }} target="_blank"{{ end }}>
{{- .Pre | safeHTML }}{{ .Name -}}
</a>
{{- end -}}
<span class="menu-item">|</span>
<a href="javascript:void(0);" class="menu-item theme-switch" title="{{ T "switchTheme" }}">
<i class="fas fa-adjust fa-fw"></i>
</a>
{{- if .Site.IsMultiLingual -}}
<a href="javascript:void(0);" class="menu-item" title="{{ T "selectLanguage" }}">
{{- .Language.LanguageName -}}
<i class="fas fa-chevron-right fa-fw"></i>
<select class="language-select" id="language-select-desktop" 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>
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
</select>
</a>
{{- end -}}
</div>
</div>
</header>
{{- /* Mobile header */ -}}
<header class="mobile" id="header-mobile">
<div class="header-wrapper">
<div class="header-container">
<div class="header-title">
<a href="{{ `/` | relLangURL }}">
{{- .Site.Title -}}
</a>
</div>
<div class="menu-toggle" id="menu-toggle-mobile">
<span></span><span></span><span></span>
</div>
</div>
<div class="menu" id="menu-mobile">
{{- $currentPage := . -}}
{{- range .Site.Menus.main -}}
<a class="menu-item" href="{{ .URL | relLangURL }}" title="{{ .Title }}" rel="noopener noreffer"{{ if strings.HasPrefix .URL "http" }} target="_blank"{{ end }}>
{{- .Pre | safeHTML }}{{ .Name -}}
</a>
{{- end -}}
<a href="javascript:void(0);" class="menu-item theme-switch" title="{{ T "switchTheme" }}">
<i class="fas fa-adjust fa-fw"></i>
</a>
{{- if .Site.IsMultiLingual -}}
<a href="javascript:void(0);" class="menu-item" title="{{ T "selectLanguage" }}">
{{- .Language.LanguageName -}}
<i class="fas fa-chevron-right fa-fw"></i>
<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>
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
</select>
</a>
{{- end -}}
</div>
</div>
</header>
<script>
window.desktopHeaderMode = {{ .Site.Params.header.desktopMode }};
window.mobileHeaderMode = {{ .Site.Params.header.mobileMode }};
</script>