Skip to content

armgit / papra

Public Imported from GitHub
0

The minimalistic document archiving platform.

feat(layout): add support for extra head tags in layout

Corentin Thomasset736380d1b3b7
diff --git a/src/components/PlausibleScript.astro b/src/components/PlausibleScript.astro
new file mode 100644
index 00000000..e304ba7c
--- /dev/null
+++ b/src/components/PlausibleScript.astro
@@ -0,0 +1,11 @@
+---
+
+const plausibleDomain: string | undefined = import.meta.env.PLAUSIBLE_DOMAIN;
+const plausibleScriptSrc: string | undefined = import.meta.env.PLAUSIBLE_SCRIPT_SRC;
+
+const hasPlausible = plausibleDomain && plausibleScriptSrc;
+---
+
+{hasPlausible && (
+ <script is:inline defer data-domain={plausibleDomain} src={plausibleScriptSrc}></script>
+)}
diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro
index 3c7b8563..2d694a30 100644
--- a/src/layouts/Layout.astro
+++ b/src/layouts/Layout.astro
@@ -1,4 +1,6 @@
---
+import PlausibleScript from '../components/PlausibleScript.astro';
+
const appName = 'Papra';
const shortDescription = 'Your Open-Source Solution to Document Chaos';
const longDescription = 'An open-source document management platform designed to help you organize, secure, and archive your files effortlessly.';
@@ -45,6 +47,7 @@ const ogImageHeight = '630';
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
<link rel="manifest" href="/site.webmanifest" />
+ <PlausibleScript />
</head>
<body class="bg-background font-sans antialiased min-h-screen text-foreground text-sm" data-kb-theme="dark">
<slot />