Vezpi 275e8ef463
All checks were successful
Deploy / Deploy (push) Successful in 6s
Add custom language button
2025-05-22 19:35:14 +00:00

39 lines
1.2 KiB
HTML

// layouts/partials/sidebar/left.html
<li class="menu-bottom-section">
<ol class="menu">
{{- $currentLanguageCode := .Language.Lang -}}
{{- $otherLanguage := "" -}}
{{ if (compare.Gt .Site.Home.AllTranslations.Len 1) }}
{{ with .Site.Home.AllTranslations }}
{{ range . }}
{{ if ne .Language.Lang $currentLanguageCode }}
{{- $otherLanguage = . -}}
{{ end }}
{{ end }}
<li id="i18n-switch">
{{ partial "helper/icon" "language" }}
<a href="{{ $otherLanguage.Permalink }}">
{{ $otherLanguage.Language.LanguageName }}
</a>
</li>
{{ end }}
{{ 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>
</li>
// assets/scss/partials/sidebar.scss
#i18n-switch {
color: var(--body-text-color);
display: flex;
align-items: center;
gap: var(--menu-icon-separation);
}