|
|
@@ -19,10 +19,17 @@ const user = tok ? getSessionUser(getDb(), tok) : null;
|
|
|
|
const canTags = !!user && (user.role === 'superuser' || user.role === 'admin');
|
|
|
|
const canTags = !!user && (user.role === 'superuser' || user.role === 'admin');
|
|
|
|
const wantTags = Astro.cookies.get('showtags')?.value === '1' || Astro.url.searchParams.get('annotate') === '1';
|
|
|
|
const wantTags = Astro.cookies.get('showtags')?.value === '1' || Astro.url.searchParams.get('annotate') === '1';
|
|
|
|
const showTags = canTags && wantTags;
|
|
|
|
const showTags = canTags && wantTags;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Google Tag Manager: l'ID container arriva da GTM_ID (.env), letto a runtime via process.env
|
|
|
|
|
|
|
|
// perché in SSR le PUBLIC_* di Vite verrebbero inlinate a build-time. Se vuoto GTM non carica.
|
|
|
|
|
|
|
|
const gtmId = process.env.GTM_ID;
|
|
|
|
---
|
|
|
|
---
|
|
|
|
<!doctype html>
|
|
|
|
<!doctype html>
|
|
|
|
<html lang="it">
|
|
|
|
<html lang="it">
|
|
|
|
<head>
|
|
|
|
<head>
|
|
|
|
|
|
|
|
{gtmId && (
|
|
|
|
|
|
|
|
<script is:inline set:html={`(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','${gtmId}');`} />
|
|
|
|
|
|
|
|
)}
|
|
|
|
<meta charset="utf-8" />
|
|
|
|
<meta charset="utf-8" />
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
|
|
<title>{title} — InsanityLab</title>
|
|
|
|
<title>{title} — InsanityLab</title>
|
|
|
@@ -36,6 +43,9 @@ const showTags = canTags && wantTags;
|
|
|
|
<script is:inline>document.documentElement.classList.add('js');</script>
|
|
|
|
<script is:inline>document.documentElement.classList.add('js');</script>
|
|
|
|
</head>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<body>
|
|
|
|
|
|
|
|
{gtmId && (
|
|
|
|
|
|
|
|
<noscript set:html={`<iframe src="https://www.googletagmanager.com/ns.html?id=${gtmId}" height="0" width="0" style="display:none;visibility:hidden"></iframe>`} />
|
|
|
|
|
|
|
|
)}
|
|
|
|
<Header user={user} showTags={showTags} canTags={canTags} />
|
|
|
|
<Header user={user} showTags={showTags} canTags={canTags} />
|
|
|
|
<main><slot /></main>
|
|
|
|
<main><slot /></main>
|
|
|
|
<Footer />
|
|
|
|
<Footer />
|
|
|
|