Skip to content

Commit 01513fb

Browse files
committed
fix: prevent analytics script from loading in development environment
1 parent b8fad4d commit 01513fb

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

src/layouts/BaseLayout.astro

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export interface Props {
44
}
55
66
const { title } = Astro.props;
7+
const isProd = import.meta.env.PROD;
78
---
89

910
<!doctype html>
@@ -14,11 +15,17 @@ const { title } = Astro.props;
1415
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
1516
<meta name="generator" content={Astro.generator} />
1617
<title>{title}</title>
17-
<script
18-
type="text/partytown"
19-
defer
20-
data-domain="milan-codes.github.io"
21-
src="https://plausible.io/js/script.js"></script>
18+
{
19+
isProd && (
20+
<script
21+
type="text/partytown"
22+
defer
23+
data-domain="milan-codes.github.io"
24+
src="https://plausible.io/js/script.js"
25+
is:inline
26+
/>
27+
)
28+
}
2229
</head>
2330
<body class="max-w-lg mx-auto px-4 bg-gray-50 dark:bg-[#0a0a0a]">
2431
<slot />

0 commit comments

Comments
 (0)