mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2025-04-29 03:53:30 +08:00
28 lines
1.1 KiB
HTML
28 lines
1.1 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="{{ .Site.LanguageCode }}">
|
|
{{- partial "head/head.html" . -}}
|
|
<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 extended flex on-phone--column align-items--flex-start {{ 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>
|