-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdefault.hbs
More file actions
71 lines (50 loc) · 2.11 KB
/
Copy pathdefault.hbs
File metadata and controls
71 lines (50 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<!DOCTYPE html>
<html lang="{{@site.locale}}" class="scroll-smooth overflow-x-hidden">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link rel="stylesheet" type="text/css" href="{{asset 'dist/css/main.css'}}" />
<script src="{{asset 'dist/js/main.js'}}" defer></script>
{{#is "post"}}
<!-- Highlight.js CSS (Dark Theme) -->
<link type="text/css" rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github-dark.min.css" />
{{/is}}
<title>{{meta_title}}</title>
{{> "style-script"}} {{!-- partials/style-script.hbs --}}
{{!-- Fix the white screen issue and the toggling between dark and light themes. --}}
<script>
document.addEventListener('alpine:init', () => {
Alpine.data('themeSwitcher', () => ({
darkMode: localStorage.getItem('theme') === 'dark' || (!localStorage.getItem('theme') && window.matchMedia('(prefers-color-scheme: dark)').matches),
toggle() {
this.darkMode = !this.darkMode;
localStorage.setItem('theme', this.darkMode ? 'dark' : 'light');
this.updateTheme();
},
updateTheme() {
if (this.darkMode) {
document.documentElement.classList.add('dark');
} else {
document.documentElement.classList.remove('dark');
}
},
init() {
this.updateTheme();
}
}))
})
</script>
{{ghost_head}}
</head>
<body class="{{body_class}} bg-background text-foreground relative p-0 m-0 overscroll-none antialiased scroll-smooth">
{{> header }} {{!-- partials/header.hbs --}}
<main class="mt-20">
{{{ body }}} {{!-- Render the main content of the page --}}
</main>
{{> footer }} {{!-- partials/footer.hbs --}}
{{!-- ghost footer --}}
{{ghost_foot}}
</body>
</html>