2022-03-04 10:24:21 +01:00
< aside class = "sidebar left-sidebar sticky {{ if .Site.Params.sidebar.compact }}compact{{ end }}" >
2020-09-09 17:17:09 +02:00
< button class = "hamburger hamburger--spin" type = "button" id = "toggle-menu" aria-label = "{{ T `toggleMenu` }}" >
2020-08-22 13:20:08 +02:00
< span class = "hamburger-box" >
< span class = "hamburger-inner" ></ span >
</ span >
</ button >
2022-03-03 23:11:19 +01:00
< header >
2020-09-06 12:56:44 +02:00
{{ with .Site.Params.sidebar.avatar }}
2026-01-26 15:50:18 +01:00
{{ if .enabled }}
2020-08-24 21:20:59 +02:00
< figure class = "site-avatar" >
2022-01-20 11:38:16 +01:00
< a href = "{{ .Site.BaseURL | relLangURL }}" >
2020-12-11 16:33:02 +01:00
{{ if not .local }}
< img src = "{{ .src }}" width = "300" height = "300" class = "site-logo" loading = "lazy" alt = "Avatar" >
2020-09-06 12:56:44 +02:00
{{ else }}
2020-12-11 16:33:02 +01:00
{{ $avatar := resources.Get (.src) }}
{{ if $avatar }}
{{ $avatarResized := $avatar.Resize "300x" }}
< img src = "{{ $avatarResized.RelPermalink }}" width = "{{ $avatarResized.Width }}"
height = "{{ $avatarResized.Height }}" class = "site-logo" loading = "lazy" alt = "Avatar" >
{{ else }}
{{ errorf "Failed loading avatar from %q" . }}
{{ end }}
2020-09-06 12:56:44 +02:00
{{ end }}
2022-01-20 11:38:16 +01:00
</ a >
2020-11-23 10:01:39 +01:00
{{ with $.Site.Params.sidebar.emoji }}
2020-11-23 10:47:22 +01:00
< span class = "emoji" > {{ . }}</ span >
2020-11-23 10:01:39 +01:00
{{ end }}
2020-08-24 21:20:59 +02:00
</ figure >
2021-07-23 16:56:52 +08:00
{{ end }}
2020-08-24 21:20:59 +02:00
{{ end }}
2021-10-23 11:58:55 +02:00
2022-03-03 23:11:19 +01:00
< div class = "site-meta" >
< h1 class = "site-name" >< a href = "{{ .Site.BaseURL | relLangURL }}" > {{ .Site.Title }}</ a ></ h1 >
< h2 class = "site-description" > {{ .Site.Params.sidebar.subtitle }}</ h2 >
</ div >
2020-08-22 13:20:08 +02:00
</ header >
2022-03-04 10:24:21 +01:00
{{- with .Site.Menus.social -}}
2024-03-27 16:24:03 +01:00
< ol class = "menu-social" >
2022-03-04 10:24:21 +01:00
{{ range . }}
< li >
< a
href = '{{ .URL }}'
{{ if eq ( default true . Params . newTab ) true }} target = "_blank" {{ end }}
{{ with . Name }} title = "{{ . }}" {{ end }}
2022-10-29 13:04:21 +01:00
rel = "me"
2022-03-04 10:24:21 +01:00
>
{{ $icon := default "link" .Params.Icon }}
{{ with $icon }}
{{ partial "helper/icon" . }}
{{ end }}
</ a >
</ li >
{{ end }}
</ ol >
{{- end -}}
2020-09-14 13:38:24 +02:00
< ol class = "menu" id = "main-menu" >
2020-08-22 13:20:08 +02:00
{{ $currentPage := . }}
{{ range .Site.Menus.main }}
2025-11-01 20:41:10 +00:00
{{ $active := or (eq $currentPage.RelPermalink .URL) (or ($currentPage.HasMenuCurrent "main" .) ($currentPage.IsMenuCurrent "main" .)) }}
2020-08-22 13:20:08 +02:00
< li {{ if $ active }} class = 'current' {{ end }} >
2022-10-29 17:28:47 +02:00
< a href = '{{ .URL }}' {{ if eq . Params . newTab true }} target = "_blank" {{ end }} >
2021-10-23 09:18:44 +02:00
{{ $icon := default .Pre .Params.Icon }}
2020-08-24 21:20:59 +02:00
{{ if .Pre }}
2024-03-27 10:09:17 +00:00
{{ warnf "Menu item [%s] is using [pre] field to set icon, please use [params.icon] instead.\nMore information: https://stack.jimmycai.com/config/menu" .URL }}
2021-10-23 09:18:44 +02:00
{{ end }}
{{ with $icon }}
{{ partial "helper/icon" . }}
2020-08-24 21:20:59 +02:00
{{ end }}
2020-08-22 13:20:08 +02:00
< span > {{- .Name -}}</ span >
</ a >
</ li >
{{ end }}
2024-03-10 23:56:30 +02:00
< li class = "menu-bottom-section" >
< ol class = "menu" >
{{- $currentLanguageCode := .Language.Lang -}}
2026-01-25 23:55:50 +01:00
{{ if hugo.IsMultilingual }}
< li id = "i18n-switch" >
{{ partial "helper/icon" "language" }}
< select name = "language" title = "language" onchange = "window.location.href = this.selectedOptions[0].value" >
{{ range .Site.Home.AllTranslations }}
{{ $target := . }}
{{ range $.AllTranslations }}
{{ if eq .Language.Lang $target.Language.Lang }}
{{ $target = . }}
{{ end }}
2024-03-10 23:56:30 +02:00
{{ end }}
2026-01-25 23:55:50 +01:00
< option value = "{{ $target.RelPermalink }}" {{ if eq $ target . Language . Lang $ currentLanguageCode }} selected {{ end }} > {{ .Language.LanguageName }}</ option >
{{ end }}
</ select >
</ li >
2024-03-10 23:56:30 +02:00
{{ end }}
2026-01-26 15:50:18 +01:00
{{ if .Site.Params.colorScheme.toggle }}
2024-03-10 23:56:30 +02:00
< li id = "dark-mode-toggle" >
{{ partial "helper/icon" "toggle-left" }}
{{ partial "helper/icon" "toggle-right" }}
< span > {{ T "darkMode" }}</ span >
2024-02-26 05:43:14 -06:00
</ li >
{{ end }}
2024-03-10 23:56:30 +02:00
</ ol >
</ li >
</ ol >
2020-11-23 10:47:22 +01:00
</ aside >