website/layouts/partials/sidebar.html

45 lines
1.6 KiB
HTML
Raw Normal View History

2022-12-24 14:59:52 +01:00
{{ $currentPage := . }}
<nav id="sidebar">
<header>
<img id="avatar" src="/2021_vrifox-avatar.png">
<p id="name">{{ .Site.Params.displayName }}</p>
<p id="information">
<span>{{ .Site.Params.username }}</span>
</p>
</header>
<section id="sidebar-menu">
<ul>
{{- range .Site.Menus.main }}
{{ if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }}
2023-01-06 21:47:57 +01:00
<li class="active"><a href="{{ .URL }}">{{ i18n .Identifier | default .Name }}</a></li>
2022-12-24 14:59:52 +01:00
{{ else }}
2023-01-06 21:47:57 +01:00
<li><a href="{{ .URL }}">{{ i18n .Identifier | default .Name }}</a></li>
2022-12-24 14:59:52 +01:00
{{ end }}
{{- end }}
</ul>
</section>
<aside>
{{- if .Site.IsMultiLingual }}
{{ $siteLanguages := .Site.Languages }}
{{ $pageLanguage := .Page.Lang }}
<div id="language-select">
<span id="language-icon" href="#" data-page-lang="{{ .Page.Lang }}">🌐</span>
<ul id="languages">
{{ range .Page.AllTranslations }}
{{ $translation := . }}
{{ range $siteLanguages }}
{{ if eq $translation.Lang .Lang }}
{{ if eq $pageLanguage .Lang }}
<li class="active"><a href="{{ $translation.Permalink }}">{{ .LanguageName }}</a></li>
{{ else }}
<li><a href="{{ $translation.Permalink }}">{{ .LanguageName }}</a></li>
{{ end }}
{{ end }}
{{ end }}
{{ end }}
</ul>
</div>
{{- end }}
</nav>