358e63e799
* feat(darkmode): initial support for dark mode toggle * fix(darkmode): add svg icons * feat(darkmode): dispatch onColorSchemeChange event * add head/darkmode * feat(darkmode); add colorScheme config * style: remove empty line * refactor(darkmode): simplify code * style: add comment for darkmode config * i18n support for dark mode toggle * Some renaming
58 lines
2.3 KiB
HTML
58 lines
2.3 KiB
HTML
<aside class="sidebar left-sidebar sticky">
|
|
<button class="hamburger hamburger--spin" type="button" id="toggle-menu" aria-label="{{ T `toggleMenu` }}">
|
|
<span class="hamburger-box">
|
|
<span class="hamburger-inner"></span>
|
|
</span>
|
|
</button>
|
|
|
|
<header class="site-info">
|
|
{{ with .Site.Params.sidebar.avatar }}
|
|
<figure class="site-avatar">
|
|
{{ if not .local }}
|
|
<img src="{{ .src }}" width="300" height="300" class="site-logo" loading="lazy" alt="Avatar">
|
|
{{ else }}
|
|
{{ $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 }}
|
|
{{ end }}
|
|
|
|
{{ with $.Site.Params.sidebar.emoji }}
|
|
<span class="emoji">{{ . }}</span>
|
|
{{ end }}
|
|
</figure>
|
|
{{ end }}
|
|
<h1 class="site-name"><a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a></h1>
|
|
<h2 class="site-description">{{ .Site.Params.sidebar.subtitle }}</h2>
|
|
</header>
|
|
|
|
<ol class="menu" id="main-menu">
|
|
{{ $currentPage := . }}
|
|
{{ range .Site.Menus.main }}
|
|
{{ $active := or (eq $currentPage.Title .Name) (or ($currentPage.HasMenuCurrent "main" .) ($currentPage.IsMenuCurrent "main" .)) }}
|
|
|
|
<li {{ if $active }} class='current' {{ end }}>
|
|
<a href='{{ .URL | relURL }}'>
|
|
{{ if .Pre }}
|
|
{{ partial "helper/icon" .Pre }}
|
|
{{ end }}
|
|
<span>{{- .Name -}}</span>
|
|
</a>
|
|
</li>
|
|
{{ end }}
|
|
|
|
{{ if (default false .Site.Params.colorScheme.toggle) }}
|
|
<li id="dark-mode-toggle">
|
|
{{ partial "helper/icon" "toggle-left" }}
|
|
{{ partial "helper/icon" "toggle-right" }}
|
|
<span>{{ T "darkMode" }}</span>
|
|
</li>
|
|
{{ end }}
|
|
</ol>
|
|
</aside>
|