summaryrefslogtreecommitdiff
path: root/layouts/_partials/header/language-switch.html
blob: 51a9c7b7d33a1674dc0d348a3ff5cc1e9b2fde49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{{ $langButtonSize := "w-4 h-4" }}

{{- $lang := .Site.Language.Lang -}}
{{- $switch := dict
  "en" (dict "url" "/zh/" "label" "ZH" "title" "查看中文博客")
  "zh" (dict "url" "/en/" "label" "EN" "title" "View English Blog") -}}
{{- $entry := index $switch $lang -}}
<a
    href="{{ $entry.url }}"
    data-umami-event="🌍 Switch Language"
    class="rounded-full text-center hover:no-underline {{ $langButtonSize }}
      bg-neutral/10 border-1 border-[var(--text-color)] border-solid
      bg-[var(--block-background-color)]
      flex items-center justify-center"
    title="{{ $entry.title }}"
>
  <span class="text-size-[0.5rem] font-extrabold">{{ $entry.label }}</span>
</a>