Add baseof template; move it from the theme
This commit is contained in:
parent
3de9cb7a5e
commit
512c8ec2da
1 changed files with 35 additions and 0 deletions
35
layouts/_default/baseof.html
Normal file
35
layouts/_default/baseof.html
Normal file
|
@ -0,0 +1,35 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
{{ $.Scratch.Delete "social-list" }}<!---->
|
||||
{{ $social := slice "twitter" "github" "instagram" }}<!---->
|
||||
{{ range $social }}<!---->
|
||||
{{ if isset site.Params . }}<!---->
|
||||
{{ $.Scratch.Add "social-list" (slice .) }}<!---->
|
||||
{{ end }}<!---->
|
||||
{{ end }}<!---->
|
||||
|
||||
<html lang="{{ site.LanguageCode }}">
|
||||
{{ partial "head.html" . }}
|
||||
|
||||
<body class="not-ready" data-menu="{{ isset site.Menus `main` }}">
|
||||
{{ partial "header.html" . }}
|
||||
|
||||
<main class="main">{{ block "main" . }}{{ end }}</main>
|
||||
|
||||
{{ partial "footer.html" . }}
|
||||
</body>
|
||||
<script>
|
||||
let bodyClx = document.body.classList;
|
||||
let sysDark = window.matchMedia('(prefers-color-scheme: dark)');
|
||||
let darkVal = localStorage.getItem('dark');
|
||||
|
||||
let setDark = (isDark) => {
|
||||
bodyClx[isDark ? 'add' : 'remove']('dark');
|
||||
localStorage.setItem('dark', isDark ? 'yes' : 'no');
|
||||
};
|
||||
|
||||
setDark(darkVal ? darkVal === 'yes' : sysDark.matches);
|
||||
requestAnimationFrame(() => bodyClx.remove('not-ready'));
|
||||
sysDark.addEventListener('change', (event) => setDark(event.matches));
|
||||
</script>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue