-
Notifications
You must be signed in to change notification settings - Fork 0
/
base.njk
100 lines (91 loc) · 4.59 KB
/
base.njk
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<!doctype html>
<html lang="{{ metadata.language }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ title or metadata.title }}</title>
<meta name="description" content="{{ description or metadata.description }}">
<meta name="generator" content="{{ eleventy.generator }}">
<meta name="theme-color" media="(prefers-color-scheme: light)" content="#fcfcfc" />
<meta name="theme-color" media="(prefers-color-scheme: dark)" content="#070707" />
<meta property="og:type" content="website">
<meta property="og:url" content="{{ metadata.url }}">
<meta property="og:title" content="{{ title or metadata.title }}">
<meta property="og:description" content="{{ description or metadata.description }}">
<meta property="og:image" content="{{ '/icon-512.jpg' | url }}">
<meta property="twitter:card" content="summary_large_image">
<meta property="twitter:url" content="{{ metadata.url }}">
<meta property="twitter:title" content="{{ title or metadata.title }}">
<meta property="twitter:description" content="{{ description or metadata.description }}">
<meta property="twitter:image" content="{{ '/icon-512.jpg' | url }}">
<link rel="icon" href="{{ '/favicon.ico' | url }}" sizes="any">
<link rel="icon" href="{{ '/icon.svg' | url }}" type="image/svg+xml">
<link rel="apple-touch-icon" href="{{ '/apple-touch-icon.png' | url }}">
<link rel="manifest" href="{{ '/site.webmanifest' | url }}">
<link rel="stylesheet" href="{{ '/css/styles.css' | url }}">
<link rel="alternate" href="{{ metadata.feed.path }}" type="application/atom+xml" title="{{ metadata.title }}">
<link rel="alternate" href="{{ metadata.jsonfeed.path }}" type="application/json" title="{{ metadata.title }}">
</head>
<body{% if bodyClass %} class="{{ bodyClass }}"{% endif %}>
<script>
// Prevent FART (look it up) by blocking render for a tiny bit...
// First check for local settings, then check media queries, then apply fallback
function getColor() {
const colorPref = window.localStorage.getItem('color-mode');
if (typeof colorPref === 'string') {
return colorPref;
}
const mql = window.matchMedia('(prefers-color-scheme: dark)');
if (typeof mql.matches === 'boolean') {
return mql.matches ? 'dark' : 'light';
}
return 'light';
}
function getMotion() {
const motionPref = window.localStorage.getItem('motion-mode');
if (typeof motionPref === 'string') {
return motionPref;
}
const mql = window.matchMedia('(prefers-reduced-motion: no-preference)');
if (typeof mql.matches === 'boolean') {
return mql.matches ? 'no-preference' : 'reduced'
}
return 'no-preference';
}
function getParty() {
const partyPref = window.localStorage.getItem('party-mode')
if (typeof partyPref === 'string') {
return partyPref;
}
return 'no-party';
}
const colorMode = getColor();
const motionMode = getMotion();
const partyMode = getParty();
const root = document.documentElement;
root.classList.add(colorMode, partyMode, motionMode);
root.style.setProperty('--play-state', motionMode === "reduced" ? "paused" : "running")
root.style.setProperty('--transition-toggle', motionMode === "reduced" ? "0" : "1")
</script>
{% include "nav.njk" %}
<main id="main" {% if templateClass %} class="content text-content flow {{ templateClass }}"{% endif %}>
{{ content | safe }}
</main>
<footer class="footer full w-full flex flex-col-to-row justify-between items-center px-1rem py-1 items-center mt-content gap-1">
<p class="color-reduced font-small m-0"><a class="color-reduced" href="https://creativecommons.org/licenses/by-nc/4.0/">CC BY-NC-SA 4.0</a> 2023 © Nathan Long.</p>
<nav class="nav-footer no-shrink">
<menu class="nav m-0 p-0 flex flex-row list-none space-x-1">
{%- for entry in collections.all | eleventyNavigation %}
<li class="font-small"><a class="decoration-none" href="{{ entry.url | url }}">{{ entry.title }}</a></li>
{%- endfor %}
<li class="font-small"><a class="decoration-none" href="{{ '/feed/feed.xml' | url }}">RSS</a></li>
</menu>
</footer>
{% if extraJS %}
{%- for item in extraJS %}
<script name="{{item.name}}" src="{{ item.src | url }}"></script>
{%- endfor %}
{% endif %}
<script type="module" src="{{ '/js/main.js' | url }}"></script>
</body>
</html>