erynwells.me/layouts/_default/baseof.html

49 lines
1.5 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html lang="{{ site.LanguageCode }}">
{{ partial "head.html" . }}
2022-09-03 15:30:38 -07:00
<body>
{{ block "body" . }}
{{ block "header" . }}{{ end }}
<main>
2021-12-26 12:43:26 -07:00
{{ block "main" . }}{{ end }}
</main>
2022-09-03 15:30:38 -07:00
{{ block "footer" . }}{{ end }}
{{ end }}
</body>
2022-09-03 15:30:38 -07:00
<style>
@font-face {
font-family: "Museo_Slab";
src: url("{{ `/fonts/Museo_Slab_500.woff2` | absURL }}") format("woff2"),
url("{{ `/fonts/Museo_Slab_500.woff` | absURL }}") format("woff");
font-weight: normal;
font-style: normal;
}
</style>
{{ block "styles" . }}{{ end }}
{{ if not hugo.IsProduction }}
<link rel="stylesheet" as="style" href="/styles/development.css">
2022-08-27 10:09:55 -07:00
{{ end }}
2022-09-03 15:30:38 -07:00
{{ range .Resources.Match "*.css" }}
<link rel="stylesheet" as="style" href="{{ .Permalink }}">
2022-08-27 10:09:55 -07:00
{{ end }}
2022-09-03 15:30:38 -07:00
{{ block "scripts" . }}{{ end }}
2022-08-27 10:09:55 -07:00
<script>
const bodyClasses = document.body.classList;
const systemDarkModeMatch = window.matchMedia('(prefers-color-scheme: dark)');
const localStorageDarkMode = localStorage.getItem('dark');
const setDark = isDark => {
2021-12-26 12:43:26 -07:00
bodyClasses[isDark ? 'add' : 'remove']('dark');
localStorage.setItem('dark', isDark ? 'yes' : 'no');
};
2021-12-26 12:43:26 -07:00
setDark(localStorageDarkMode ? localStorageDarkMode === 'yes' : systemDarkModeMatch.matches);
requestAnimationFrame(() => bodyClasses.remove('not-ready'));
systemDarkModeMatch.addEventListener('change', (event) => setDark(event.matches));
</script>
</html>