2025-04-25 16:42:10 +08:00
|
|
|
<!DOCTYPE html>
|
2025-05-04 15:58:10 +08:00
|
|
|
<html>
|
|
|
|
|
<head>
|
2025-06-15 08:53:35 +08:00
|
|
|
{# Dark mode #}
|
2025-04-25 16:42:10 +08:00
|
|
|
<script>
|
2025-06-18 19:42:26 +08:00
|
|
|
(() => {
|
2025-06-12 18:44:17 +08:00
|
|
|
try {
|
2025-06-18 19:42:26 +08:00
|
|
|
const stored = localStorage.getItem('themeMode');
|
|
|
|
|
if (stored ? stored === 'dark'
|
|
|
|
|
: matchMedia('(prefers-color-scheme: dark)').matches) {
|
|
|
|
|
document.documentElement.classList.add('dark');
|
|
|
|
|
}
|
|
|
|
|
} catch (_) {}
|
|
|
|
|
|
|
|
|
|
const apply = dark => {
|
|
|
|
|
document.documentElement.classList.toggle('dark', dark);
|
|
|
|
|
try { localStorage.setItem('themeMode', dark ? 'dark' : 'light'); } catch (_) {}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
document.addEventListener('basecoat:theme', (event) => {
|
|
|
|
|
const mode = event.detail?.mode;
|
|
|
|
|
apply(mode === 'dark' ? true
|
|
|
|
|
: mode === 'light' ? false
|
|
|
|
|
: !document.documentElement.classList.contains('dark'));
|
|
|
|
|
});
|
2025-06-12 18:44:17 +08:00
|
|
|
})();
|
2025-04-25 16:42:10 +08:00
|
|
|
</script>
|
2025-06-15 08:53:35 +08:00
|
|
|
{# Theme variant #}
|
2025-06-12 18:44:17 +08:00
|
|
|
<script>
|
|
|
|
|
(function() {
|
|
|
|
|
try {
|
|
|
|
|
const storedTheme = localStorage.getItem('themeVariant');
|
|
|
|
|
if (storedTheme) document.documentElement.classList.add(`theme-${storedTheme}`);
|
2025-06-18 19:42:26 +08:00
|
|
|
} catch (event) {
|
|
|
|
|
console.error('Could not apply theme variant from localStorage', event);
|
2025-06-12 18:44:17 +08:00
|
|
|
}
|
|
|
|
|
})();
|
|
|
|
|
</script>
|
2026-06-01 15:10:35 +08:00
|
|
|
{# Style variant #}
|
|
|
|
|
<script>
|
|
|
|
|
(function() {
|
|
|
|
|
try {
|
|
|
|
|
const storedStyle = localStorage.getItem('styleVariant') || 'vega';
|
|
|
|
|
document.documentElement.dataset.styleVariant = storedStyle;
|
|
|
|
|
} catch (event) {
|
|
|
|
|
console.error('Could not apply style variant from localStorage', event);
|
|
|
|
|
}
|
|
|
|
|
})();
|
|
|
|
|
</script>
|
2025-06-15 08:53:35 +08:00
|
|
|
{# Meta #}
|
2025-04-25 16:42:10 +08:00
|
|
|
<meta charset="utf-8">
|
|
|
|
|
<meta http-equiv="Content-Language" content="en">
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
2025-06-15 08:53:35 +08:00
|
|
|
{# Title & Description #}
|
2025-05-08 11:48:04 +08:00
|
|
|
{% set meta_title = title ~ ' | ' ~ site.title if title else site.title %}
|
|
|
|
|
{% set meta_description = description or site.description %}
|
|
|
|
|
<title>{{ meta_title }}</title>
|
|
|
|
|
<meta name="description" content="{{ meta_description }}"/>
|
|
|
|
|
<meta name="title" content="{{ meta_title }}">
|
2025-05-08 19:51:02 +08:00
|
|
|
{% if site.keywords %}<meta name="keywords" content="{{ site.keywords | join(',') }}" />{% endif %}
|
2025-06-15 08:53:35 +08:00
|
|
|
{# Favicon #}
|
2025-05-06 20:39:14 +08:00
|
|
|
<link rel="icon" type="image/svg+xml" href="/assets/favicon.svg">
|
|
|
|
|
<link rel="apple-touch-icon" sizes="180x180" href="/assets/apple-touch-icon.png">
|
2025-06-15 08:53:35 +08:00
|
|
|
{# Open Graph / Facebook #}
|
2025-05-08 11:48:04 +08:00
|
|
|
<meta property="og:type" content="website">
|
|
|
|
|
<meta property="og:url" content="{{ site.url }}{{ page.url }}">
|
|
|
|
|
<meta property="og:title" content="{{ meta_title }}">
|
|
|
|
|
<meta property="og:description" content="{{ meta_description }}">
|
2025-05-08 22:13:15 +08:00
|
|
|
<meta property="og:image" content="{{ site.url }}/assets/social-screenshot.png">
|
2025-05-08 11:48:04 +08:00
|
|
|
<meta property="og:site_name" content="{{ site.title }}">
|
|
|
|
|
<meta property="og:locale" content="en_US">
|
|
|
|
|
<meta property="og:author" content="{{ site.author.name }}">
|
2025-06-15 08:53:35 +08:00
|
|
|
{# X/Twitter #}
|
2025-05-08 11:48:04 +08:00
|
|
|
<meta name="twitter:card" content="summary_large_image">
|
|
|
|
|
<meta name="twitter:url" content="{{ site.url }}{{ page.url }}">
|
|
|
|
|
<meta name="twitter:title" content="{{ title if title else site.title }}">
|
|
|
|
|
<meta name="twitter:description" content="{{ meta_description }}">
|
2025-05-08 22:13:15 +08:00
|
|
|
<meta name="twitter:image" content="{{ site.url }}/assets/social-screenshot.png">
|
2025-05-08 11:48:04 +08:00
|
|
|
<meta name="twitter:creator" content="{{ site.author.x }}">
|
2025-06-15 08:53:35 +08:00
|
|
|
{# CSS #}
|
2025-04-25 16:42:10 +08:00
|
|
|
<link rel="stylesheet" href="/assets/styles.css">
|
2026-06-01 15:10:35 +08:00
|
|
|
<link rel="stylesheet" id="style-variant-stylesheet">
|
|
|
|
|
<script>
|
|
|
|
|
(() => {
|
|
|
|
|
const styleLink = document.getElementById('style-variant-stylesheet');
|
|
|
|
|
const styleVariant = document.documentElement.dataset.styleVariant || 'vega';
|
|
|
|
|
if (styleVariant === 'vega') {
|
|
|
|
|
styleLink.removeAttribute('href');
|
|
|
|
|
} else {
|
|
|
|
|
styleLink.href = `/assets/style-${styleVariant}.css`;
|
|
|
|
|
}
|
|
|
|
|
})();
|
|
|
|
|
</script>
|
2025-06-15 08:53:35 +08:00
|
|
|
{# JS #}
|
2026-01-04 21:58:42 +08:00
|
|
|
<script src="/assets/js/basecoat.js?v={{ pkg.version }}" defer></script>
|
|
|
|
|
<script src="/assets/js/command.js?v={{ pkg.version }}" defer></script>
|
|
|
|
|
<script src="/assets/js/dropdown-menu.js?v={{ pkg.version }}" defer></script>
|
|
|
|
|
<script src="/assets/js/popover.js?v={{ pkg.version }}" defer></script>
|
|
|
|
|
<script src="/assets/js/select.js?v={{ pkg.version }}" defer></script>
|
|
|
|
|
<script src="/assets/js/sidebar.js?v={{ pkg.version }}" defer></script>
|
|
|
|
|
<script src="/assets/js/tabs.js?v={{ pkg.version }}" defer></script>
|
|
|
|
|
<script src="/assets/js/toast.js?v={{ pkg.version }}" defer></script>
|
2025-06-15 08:53:35 +08:00
|
|
|
{# HTMX #}
|
2025-04-25 16:42:10 +08:00
|
|
|
<script src="https://unpkg.com/htmx.org@2.0.4"></script>
|
2025-06-15 08:53:35 +08:00
|
|
|
{# Highlight.js #}
|
2025-04-26 11:59:53 +08:00
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
|
|
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/django.min.js"></script>
|
|
|
|
|
<script>
|
2025-06-16 17:58:01 +08:00
|
|
|
const highlight = () => {
|
|
|
|
|
if (!window.hljs) return;
|
|
|
|
|
document
|
2025-06-16 19:54:37 +08:00
|
|
|
.querySelectorAll('pre code:not([data-highlighted]), code.highlight:not([data-highlighted])')
|
2025-06-16 17:58:01 +08:00
|
|
|
.forEach(el => hljs.highlightElement(el));
|
|
|
|
|
};
|
2025-04-26 11:59:53 +08:00
|
|
|
|
2025-06-16 17:58:01 +08:00
|
|
|
if (!window._hljsInit) {
|
|
|
|
|
window._hljsInit = true;
|
|
|
|
|
document.addEventListener('DOMContentLoaded', highlight);
|
|
|
|
|
document.addEventListener('htmx:afterSwap', highlight);
|
2025-04-26 11:59:53 +08:00
|
|
|
}
|
|
|
|
|
</script>
|
2025-07-28 18:16:41 +08:00
|
|
|
<script>
|
|
|
|
|
document.addEventListener('htmx:historyRestore', () => {
|
|
|
|
|
if (window.basecoat) window.basecoat.initAll();
|
|
|
|
|
});
|
|
|
|
|
</script>
|
2025-04-26 11:59:53 +08:00
|
|
|
{% if head %}{{ head | safe }}{% endif %}
|
2025-04-25 16:42:10 +08:00
|
|
|
</head>
|
|
|
|
|
<body>
|
2025-05-07 12:03:38 +08:00
|
|
|
{{ content | safe }}
|
2025-05-07 14:57:30 +08:00
|
|
|
|
|
|
|
|
{% from "toast.njk" import toaster %}
|
|
|
|
|
{{ toaster() }}
|
2025-04-25 16:42:10 +08:00
|
|
|
</body>
|
2026-06-01 15:10:35 +08:00
|
|
|
</html>
|