Files
palina-theme/default.hbs
2026-02-20 11:25:13 +01:00

64 lines
2.3 KiB
Handlebars

<!DOCTYPE html>
<html lang="{{@site.lang}}"
x-data="{
theme: localStorage.getItem('theme') || (window.matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark'),
mobileMenuOpen: false,
currentPath: window.location.pathname,
init() {
$watch('theme', val => {
localStorage.setItem('theme', val);
document.documentElement.setAttribute('data-theme', val);
});
document.documentElement.setAttribute('data-theme', this.theme);
document.documentElement.classList.remove('hidden');
// Update currentPath on navigation to keep menu highlights in sync
document.addEventListener('htmx:afterSettle', () => {
this.currentPath = window.location.pathname;
this.mobileMenuOpen = false;
});
}
}"
:data-theme="theme"
class="hidden">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{meta_title}}{{#is "index"}}{{@site.title}}{{else}}{{@site.title}}{{/is}}</title>
<link rel="stylesheet" href="{{asset "built/screen.css"}}">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&family=Fraunces:ital,opsz,wght@0,9..144,100..900;1,9..144,100..900&display=swap" rel="stylesheet">
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
<script src="https://unpkg.com/htmx.org@2.0.0"></script>
{{ghost_head}}
</head>
<body
class="{{body_class}} font-sans antialiased min-h-screen flex flex-col"
hx-boost="true"
hx-target="#main-content"
hx-select="#main-content"
hx-swap="innerHTML show:top"
>
{{!--
PERSISTENT SHELL:
These elements are OUTSIDE #main-content, so they never swap.
This keeps Alpine state (mobileMenuOpen) perfectly stable.
--}}
{{> mobile-menu}}
{{> header}}
<main id="main-content" class="flex-grow">
{{{body}}}
</main>
{{> footer}}
{{ghost_foot}}
<script src="{{asset "js/ghost-config.js"}}"></script>
<script src="{{asset "js/main.js"}}"></script>
</body>
</html>