website/layouts/partials/sidebar.html
2023-05-17 14:30:00 +02:00

44 lines
2 KiB
HTML

{{ $currentPage := . }}
<nav id="sidebar">
<header>
{{ with .Site.Params.avatar }}
{{ $avatar := resources.Get . }}
{{ $avatar := $avatar.Resize "64x webp" }}
<img id="avatar" alt="{{ $.Site.Params.displayName }}" src="{{ $avatar.RelPermalink }}" />
{{ end }}
</header>
<section id="sidebar-menu">
<ul>
{{- range .Site.Menus.main }}
{{ if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }}
<li class="active"><a class="hint-text" href="{{ .URL }}" data-title="{{ i18n .Identifier | default .Name }}" aria-label="{{ i18n .Identifier | default .Name }}">{{ partial "helpers/icons" .Identifier }}</a></li>
{{ else }}
<li><a class="hint-text" href="{{ .URL }}" data-title="{{ i18n .Identifier | default .Name }}" aria-label="{{ i18n .Identifier | default .Name }}">{{ partial "helpers/icons" .Identifier }}</a></li>
{{ end }}
{{- end }}
</ul>
</section>
<aside>
<section id="social-links">
<a class="hint-text" rel="me" href="https://social.anoxinon.de/@vri" aria-label="Mastodon">{{ partial "helpers/icons" "mastodon" }}</a>
</section>
<section id="languages">
{{- if .Site.IsMultiLingual }}
{{ $siteLanguages := .Site.Languages }}
{{ $pageLanguage := .Page.Lang }}
{{ range .Page.AllTranslations }}
{{ $translation := . }}
{{ range $siteLanguages }}
{{ if eq $translation.Lang .Lang }}
{{ if ne $pageLanguage .Lang }}
<a class="hint-text" id="language" href="{{ $translation.Permalink }}" aria-label="{{ .LanguageName }}">{{ .Params.languageFlag }}</a>
{{ end }}
{{ end }}
{{ end }}
{{ end }}
{{- end }}
</section>
</aside>
</nav>