analytics: only include umami script in production builds

pull/1/head
maia arson crimew 2023-06-08 17:31:43 +02:00
parent 53ae101b6d
commit 84a3e65c54
3 changed files with 14 additions and 4 deletions

View File

@ -3,8 +3,8 @@
"version": "1.0.0",
"description": "",
"scripts": {
"build": "rm -rf www && eleventy",
"serve": "rm -rf www && eleventy --serve",
"build": "ELEVENTY_ENV=prod rm -rf www && eleventy",
"serve": "ELEVENTY_ENV=dev rm -rf www && eleventy --serve",
"update": "git pull && npm i && npm run build"
},
"dependencies": {

9
src/_data/env.js Normal file
View File

@ -0,0 +1,9 @@
module.exports = function() {
return {
environment: {
environment: process.env.ELEVENTY_ENV || "dev",
isProd: process.env.ELEVENTY_ENV == "prod",
isDev: (process.env.ELEVENTY_ENV || "dev") == "dev"
}
};
}

View File

@ -27,8 +27,9 @@
<link rel="shortcut icon" href="/favicon.ico">
<link rel="alternate" type="application/rss+xml" href="/feed.xml" />
<script async src="https://umami.crimew.gay/script.js" data-website-id="fa7a72e7-acbc-488d-beb2-213886be0262"></script>
{% if env.environment.isProd %}
<script async src="https://umami.crimew.gay/script.js" data-website-id="fa7a72e7-acbc-488d-beb2-213886be0262"></script>
{% endif %}
</head>
<body>
<header id="site_header">