hugo-theme-stack/layouts/_default/baseof.html
Alex Hua 5981551998 feat: auto-switch site lang when homepage visited
1. auto-switch site lang according to setting from sidebar
   or browser lang settings, when home page is visited.
2. save sidebar lang setting to local storage.
2023-04-08 19:41:03 +08:00

30 lines
1.1 KiB
HTML

<!DOCTYPE html>
<html lang="{{ .Site.LanguageCode }}" dir="{{ default `ltr` .Language.LanguageDirection }}">
<head>
{{- partial "head/head.html" . -}}
{{- block "head" . -}}{{ end }}
</head>
<body class="{{ block `body-class` . }}{{ end }}">
{{- partial "head/colorScheme" . -}}
{{- partial "head/autoLang" . -}}
{{/* The container is wider when there's any activated widget */}}
{{- $hasWidget := false -}}
{{- range .Site.Params.widgets -}}
{{- if gt (len .) 0 -}}
{{- $hasWidget = true -}}
{{- end -}}
{{- end -}}
<div class="container main-container flex on-phone--column {{ if $hasWidget }}extended{{ else }}compact{{ end }}">
{{- block "left-sidebar" . -}}
{{ partial "sidebar/left.html" . }}
{{- end -}}
{{- block "right-sidebar" . -}}{{ end }}
<main class="main full-width">
{{- block "main" . }}{{- end }}
</main>
</div>
{{ partial "footer/include.html" . }}
</body>
</html>