diff --git a/docs/vercel.json b/docs/vercel.json
index 7ae6aa0cc..3c4ddefdd 100644
--- a/docs/vercel.json
+++ b/docs/vercel.json
@@ -9,6 +9,14 @@
"source": "/stats/event",
"destination": "https://plausible.io/api/event"
},
+ {
+ "source": "/eat/static/:path(.*)",
+ "destination": "https://eu-assets.i.posthog.com/static/:path*"
+ },
+ {
+ "source": "/eat/:path(.*)",
+ "destination": "https://eu.i.posthog.com/:path*"
+ },
{
"source": "/(.*)",
"destination": "/error-404.html"
diff --git a/preview/.build/remove-prettier-ignore.mjs b/preview/.build/remove-prettier-ignore.mjs
new file mode 100644
index 000000000..5de104a32
--- /dev/null
+++ b/preview/.build/remove-prettier-ignore.mjs
@@ -0,0 +1,25 @@
+// remove-prettier-ignore.js
+import { readFileSync, writeFileSync } from 'fs';
+import { sync } from 'glob';
+
+const patterns = [
+ /\/\/ prettier-ignore[\s]*/g,
+];
+
+sync('dist/**/*.html').forEach(file => {
+ let content = readFileSync(file, 'utf8');
+ let modified = false;
+
+ patterns.forEach(pattern => {
+ const newContent = content.replace(pattern, '');
+ if (newContent !== content) {
+ content = newContent;
+ modified = true;
+ }
+ });
+
+ if (modified) {
+ writeFileSync(file, content);
+ console.log(`Cleaned: ${file}`);
+ }
+});
diff --git a/preview/package.json b/preview/package.json
index a67d30635..4cbe2dd66 100644
--- a/preview/package.json
+++ b/preview/package.json
@@ -18,9 +18,10 @@
"js-minify": "pnpm run js-minify-demo",
"js-minify-demo": "terser --compress passes=2 --mangle --comments \"/^!/\" --source-map \"content=dist/preview/js/demo.js.map,includeSources,url=demo.min.js.map\" --output dist/preview/js/demo.min.js dist/preview/js/demo.js",
"clean": "shx rm -rf dist demo",
- "html": "pnpm run html-build && pnpm run html-prettify",
+ "html": "pnpm run html-build && pnpm run html-prettify && pnpm run html-remove-prettier-ignore",
"html-build": "eleventy",
"html-prettify": "prettier --write \"dist/**/*.html\" \"!dist/dist/**\"",
+ "html-remove-prettier-ignore": "node .build/remove-prettier-ignore.mjs",
"svg-optimize": "svgo -f svg/brand --pretty",
"unused-files": "node .build/unused-files.mjs",
"download-images": "node .build/download-images.mjs",
diff --git a/preview/vercel.json b/preview/vercel.json
index 1acdbf2a5..683aa92d8 100644
--- a/preview/vercel.json
+++ b/preview/vercel.json
@@ -8,6 +8,14 @@
"source": "/stats/event",
"destination": "https://plausible.io/api/event"
},
+ {
+ "source": "/eat/static/:path(.*)",
+ "destination": "https://eu-assets.i.posthog.com/static/:path*"
+ },
+ {
+ "source": "/eat/:path(.*)",
+ "destination": "https://eu.i.posthog.com/:path*"
+ },
{
"source": "/(.*)",
"destination": "/error-404.html"
diff --git a/shared/e11ty/data.mjs b/shared/e11ty/data.mjs
index 79ca40f51..e4460d79c 100644
--- a/shared/e11ty/data.mjs
+++ b/shared/e11ty/data.mjs
@@ -5,4 +5,8 @@ export function appData(eleventyConfig) {
eleventyConfig.addGlobalData("package", JSON.parse(readFileSync(join("..", "core", "package.json"), "utf-8")));
eleventyConfig.addGlobalData("changelog", readFileSync(join("..", "core", "CHANGELOG.md"), "utf-8"));
eleventyConfig.addGlobalData("libs", JSON.parse(readFileSync(join("..", "core", "libs.json"), "utf-8")));
+
+ // Analytics Environment Variables
+ eleventyConfig.addGlobalData("posthogApiKey", process.env.NEXT_PUBLIC_POSTHOG_KEY);
+ eleventyConfig.addGlobalData("posthogHost", process.env.NEXT_PUBLIC_POSTHOG_HOST);
}
\ No newline at end of file
diff --git a/shared/includes/layout/analytics.html b/shared/includes/layout/analytics.html
index 38e5007c6..5405e29c7 100644
--- a/shared/includes/layout/analytics.html
+++ b/shared/includes/layout/analytics.html
@@ -1,29 +1,10 @@
-
-
{% if posthogApiKey %}
{% endif %}
\ No newline at end of file
diff --git a/shared/layouts/docs/default.html b/shared/layouts/docs/default.html
index a7a41b0b5..3369d7cac 100644
--- a/shared/layouts/docs/default.html
+++ b/shared/layouts/docs/default.html
@@ -48,12 +48,14 @@
{% if metaDescription %}{% endif %}
-
-
{% elsif environment == 'development' %}
{% endif %}
+
+ {% if environment == 'production' %}
+ {% include "layout/analytics.html" %}
+ {% endif %}
{% for plugin in site.cssPlugins %}