Build & Deploy / deploy (push) Successful in 1m32s
@vite-pwa/astro genererer en Workbox-SW der precacher alt (59 entries); autoUpdate + skipWaiting + cleanupOutdatedCaches saa redeploy aldrig strander en bruger paa gammel version. Registrering injiceret via /registerSW.js i Base.astro (manifest:false bruger den eksisterende site.webmanifest). Offline-brug + Add-to-Home-Screen. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
55 lines
1.9 KiB
Plaintext
55 lines
1.9 KiB
Plaintext
---
|
|
import { ClientRouter } from 'astro:transitions';
|
|
import Head from '../components/Head.astro';
|
|
import Header from '../components/Header.astro';
|
|
import Footer from '../components/Footer.astro';
|
|
import { SITE } from '../consts';
|
|
import '../styles/global.css';
|
|
interface Props {
|
|
title?: string;
|
|
description?: string;
|
|
image?: string;
|
|
type?: 'website' | 'article';
|
|
publishedTime?: string;
|
|
modifiedTime?: string;
|
|
tags?: string[];
|
|
jsonLd?: unknown[];
|
|
}
|
|
const { title, description, image, type, publishedTime, modifiedTime, tags, jsonLd } = Astro.props;
|
|
---
|
|
<!doctype html>
|
|
<html lang={SITE.lang}>
|
|
<head>
|
|
<script is:inline>
|
|
(() => {
|
|
const apply = () => {
|
|
const t = localStorage.getItem('theme') ||
|
|
(window.matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark');
|
|
document.documentElement.dataset.theme = t;
|
|
};
|
|
apply();
|
|
document.addEventListener('astro:after-swap', apply);
|
|
document.addEventListener('click', (e) => {
|
|
const btn = e.target.closest('[data-theme-toggle]');
|
|
if (!btn) return;
|
|
const next = document.documentElement.dataset.theme === 'light' ? 'dark' : 'light';
|
|
document.documentElement.dataset.theme = next;
|
|
localStorage.setItem('theme', next);
|
|
});
|
|
})();
|
|
</script>
|
|
<Head {title} {description} {image} {type} {publishedTime} {modifiedTime} {tags} {jsonLd} />
|
|
<ClientRouter />
|
|
<!-- Registrér service worker'en (PWA/offline). Genereret af @vite-pwa i build;
|
|
is:inline + public-sti så Astro ikke bundler den. 404 i dev = harmløst. -->
|
|
<script is:inline src="/registerSW.js"></script>
|
|
</head>
|
|
<body class="min-h-screen flex flex-col antialiased">
|
|
<Header />
|
|
<main class="mx-auto w-full max-w-3xl flex-1 px-5 py-12">
|
|
<slot />
|
|
</main>
|
|
<Footer />
|
|
</body>
|
|
</html>
|