refl.fr/src/layouts/Layout.astro

104 lines
3.3 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
import "../styles/global.css";
import Navbar from "../components/Navbar.astro";
import Footer from "../components/Footer.astro";
import CookieBanner from "../components/CookieBanner.astro";
import logo from "../assets/logo.svg";
import { SEO } from "astro-seo";
export interface Props {
/** Optional granular SEO overrides coming from .astro pages or components */
seo?: {
title?: string;
description?: string;
};
/** Standard frontmatter fields coming from Markdown/MDX pages */
title?: string;
description?: string;
}
// Destructure frontmatter fields as well as the existing `seo` object
const { seo = {}, title, description } = Astro.props;
/** Merge explicit `seo` overrides with any frontmatter fields.
* Values defined in `seo` win over frontmatter, preserving backward compatibility.
*/
const seoConfig = {
...seo,
title: seo.title ?? title,
description: seo.description ?? description,
};
---
<!doctype html>
<html lang="en" data-theme="business">
<head>
<meta charset="utf-8" />
<!-- Persisted theme (dark / light) is applied as early as possible -->
<script is:inline>
const savedTheme = localStorage.getItem('theme');
if (savedTheme) {
document.documentElement.setAttribute('data-theme', savedTheme);
}
</script>
<SEO
{...seoConfig}
title={seoConfig.title}
description={seoConfig.description ??
"ReFL - Réflexions sur les Fondements de la Logique"}
titleTemplate="%s ReFL"
titleDefault="ReFL"
/>
<slot name="head" />
<script
type="application/ld+json"
set:html={JSON.stringify({
"@context": "https://schema.org",
"@type": "Organization",
name: "ReFL",
url: Astro.site,
logo: new URL(logo.src, Astro.site).href,
sameAs: ["https://refl.zulipchat.com/"],
})}
/>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<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=Inter:wght@400;500;600;700&display=swap" rel="stylesheet" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<link rel="sitemap" href="/sitemap-index.xml" />
<meta name="generator" content={Astro.generator} />
</head>
<body
class="bg-base-100 text-base-content min-h-screen flex flex-col overflow-x-hidden"
>
<Navbar />
<!-- Main page content -->
<main class="flex-1 container mx-auto px-4 py-8">
<slot />
</main>
<Footer />
<CookieBanner />
<!-- Analytics loader (separate script to avoid ad blockers blocking the consent banner) -->
<script is:inline>
window.addEventListener('consent-granted', function() {
if (document.getElementById('ga-script')) return;
var s = document.createElement('script');
s.id = 'ga-script';
s.async = true;
s.src = 'https://www.googletagmanager.com/gtag/js?id=G-7308Y1HGM9';
document.head.appendChild(s);
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'G-7308Y1HGM9');
});
</script>
</body>
</html>