Add custom language button
All checks were successful
Deploy / Deploy (push) Successful in 6s

This commit is contained in:
Vezpi 2025-05-22 19:35:14 +00:00
parent 5ff92ea181
commit 275e8ef463

View File

@ -0,0 +1,38 @@
// 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);
}