Sfoglia il codice sorgente

feat: add Plausible analytics integration and configure Vercel rewrites

codecalm 4 mesi fa
parent
commit
8da9fa869f
2 ha cambiato i file con 20 aggiunte e 0 eliminazioni
  1. 18 0
      docs/vercel.json
  2. 2 0
      shared/layouts/docs/default.html

+ 18 - 0
docs/vercel.json

@@ -0,0 +1,18 @@
+{
+  "buildCommand": "pnpm run build",
+  "devCommand": "pnpm run dev",
+  "rewrites": [
+    {
+      "source": "/stats/js/script.js",
+      "destination": "https://plausible.io/js/script.js"
+    },
+    {
+      "source": "/stats/api/event",
+      "destination": "https://plausible.io/api/event"
+    },
+    {
+      "source": "/(.*)",
+      "destination": "/error-404.html"
+    }
+  ]
+}

+ 2 - 0
shared/layouts/docs/default.html

@@ -6,6 +6,8 @@
 	<meta name="viewport" content="width=device-width, initial-scale=1.0">
 	<title>Tabler Documentation - {{ title }}</title>
 
+	<script defer data-api="/stats/api/event" data-domain="docs.tabler.io" src="/stats/js/script.js"></script>
+
 	<link rel="stylesheet" href="/dist/css/tabler{% if environment != 'development' %}.min{% endif %}.css{% if environment != 'development' %}?{{ 'now' | date: '%s' }}{% endif %}" />
 	{% for plugin in site.cssPlugins %}
 	<link