diff --git a/src/components/CookieBanner.astro b/src/components/CookieBanner.astro new file mode 100644 index 0000000..414c096 --- /dev/null +++ b/src/components/CookieBanner.astro @@ -0,0 +1,81 @@ +--- +// Own cookie banner (no iubenda). Not a cookie wall: a floating card, the site +// stays usable behind it. Reject and Accept have the same weight. The only +// thing that needs consent is Google Analytics, loaded by window.loadAnalytics +// (BaseLayout) only after "Accept". +--- + + + + diff --git a/src/components/Footer.astro b/src/components/Footer.astro index 96466ab..c9d5c26 100644 --- a/src/components/Footer.astro +++ b/src/components/Footer.astro @@ -31,52 +31,21 @@ const maxWidth = width === "7xl" ? "max-w-7xl" : "max-w-4xl"; title="Sitemap">Sitemap • - Privacy PolicyPrivacy Policy - • - - Cookie PolicyCookie Policy - + • +
diff --git a/src/layouts/BaseLayout.astro b/src/layouts/BaseLayout.astro index 71dcc63..06675a9 100644 --- a/src/layouts/BaseLayout.astro +++ b/src/layouts/BaseLayout.astro @@ -32,74 +32,41 @@ const fullImageUrl = image : `${siteUrl}${image}` : `${siteUrl}${defaultImage}`; const fullCanonicalUrl = canonicalUrl || `${siteUrl}${Astro.url.pathname}`; +import CookieBanner from "../components/CookieBanner.astro"; --- - - - @@ -240,6 +207,8 @@ const fullCanonicalUrl = canonicalUrl || `${siteUrl}${Astro.url.pathname}`; + +
- window.__iubBannerOpen || !!document.getElementById("iubenda-cs-banner"); + // Never on top of the cookie banner: if it's open, wait for the answer + const bannerOpen = () => { + const banner = document.getElementById("cookie-banner"); + return !!banner && !banner.classList.contains("hidden"); + }; const showToast = () => { if (bannerOpen()) { - window.addEventListener("iub-consent", () => setTimeout(showToast, 1500), { once: true }); + window.addEventListener("cookie-consent", () => setTimeout(showToast, 1500), { + once: true, + }); return; } const isDarkMode = document.documentElement.classList.contains("dark"); @@ -336,27 +310,7 @@ const fullCanonicalUrl = canonicalUrl || `${siteUrl}${Astro.url.pathname}`; toast.classList.remove("hidden"); } }; - - // Never on top of the cookie banner: wait for iubenda, and if the banner - // is open wait for the visitor's answer. If iubenda never loads - // (blocked), show it anyway after a few seconds. - let scheduled = false; - const scheduleToast = (delay) => { - if (scheduled) return; - scheduled = true; - setTimeout(showToast, delay); - }; - const afterIubenda = () => { - scheduleToast(2000); - }; - if (window.__iubReady) { - afterIubenda(); - } else { - window.addEventListener("iub-ready", afterIubenda, { once: true }); - setTimeout(() => { - if (!window.__iubReady) scheduleToast(0); - }, 6000); - } + setTimeout(showToast, 2000); // Enable dark mode if (tryButton) { diff --git a/src/layouts/LegalLayout.astro b/src/layouts/LegalLayout.astro new file mode 100644 index 0000000..223c1a6 --- /dev/null +++ b/src/layouts/LegalLayout.astro @@ -0,0 +1,32 @@ +--- +import Footer from "../components/Footer.astro"; +import Navbar from "../components/Navbar.astro"; +import BaseLayout from "./BaseLayout.astro"; +import "../styles/prose.css"; + +const { frontmatter } = Astro.props; +--- + + + +
+
+
+

{frontmatter.title}

+

+ Last updated: {frontmatter.updated} +

+
+
+ +
+
+ +
+
+
+
+