hugo-theme-stack/layouts/_default/baseof.html
2020-12-19 11:37:14 +01:00

31 lines
1.2 KiB
HTML

<!DOCTYPE html>
<html lang="{{ .Site.LanguageCode }}">
<head>
{{- partial "head/head.html" . -}}
{{- block "head" . -}}{{ end }}
</head>
<body class="{{ block `body-class` . }}{{ end }}">
<script>
(function() {
const darkModeKey = 'StackDarkMode';
const darkModeItem = localStorage.getItem(darkModeKey);
const darkModeEnabled = localStorage.getItem(darkModeKey) === 'true';
const supportDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches === true;
if(darkModeItem && darkModeEnabled || !darkModeItem && supportDarkMode){
document.body.classList.add('theme-dark');
}
})();
</script>
<div class="container flex on-phone--column align-items--flex-start {{ if .Site.Params.widgets.enabled }}extended{{ else }}compact{{ end }} {{ block `container-class` . }}{{end}}">
{{ partial "sidebar/left.html" . }}
<main class="main full-width">
{{- block "main" . }}{{- end }}
</main>
{{- block "right-sidebar" . -}}{{ end }}
</div>
{{ partial "footer/include.html" . }}
</body>
</html>