Skip to content

Commit 10b5a75

Browse files
committed
Add Umami analytics
1 parent c354988 commit 10b5a75

3 files changed

Lines changed: 27 additions & 4 deletions

File tree

.github/workflows/build-pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ jobs:
2828
run: pnpm install
2929

3030
- name: Build application
31+
run: pnpm build
3132
env:
3233
NUXT_PUBLIC_COMMIT_HASH: ${{ github.sha }}
33-
run: pnpm build

.github/workflows/build.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@ jobs:
2828
run: pnpm install
2929

3030
- name: Build application
31+
run: pnpm build
3132
env:
3233
NUXT_PUBLIC_COMMIT_HASH: ${{ github.sha }}
33-
run: pnpm build
34+
UMAMI_WEBSITE_ID: ${{ secrets.UMAMI_WEBSITE_ID }}
35+
UMAMI_SCRIPT_URL: ${{ secrets.UMAMI_SCRIPT_URL }}
3436

3537
- name: Deploy to Cloudflare Pages
3638
uses: cloudflare/wrangler-action@v3

.vitepress/config.mts

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,32 @@
1-
import { defineConfig } from "vitepress";
1+
import { defineConfig, type HeadConfig } from "vitepress";
22
import sidebar from "./sidebar.mjs";
33

4+
const umamiUrl = process.env.UMAMI_URL ?? ""
5+
const umamiId = process.env.UMAMI_ID ?? ""
6+
const umamiScript: HeadConfig[] =
7+
umamiUrl && umamiId
8+
? [
9+
[
10+
"script",
11+
{
12+
async: "",
13+
defer: "",
14+
src: umamiUrl,
15+
"data-domains": "www.leafmc.one",
16+
"data-website-id": umamiId,
17+
},
18+
],
19+
]
20+
: []
21+
422
// https://vitepress.dev/reference/site-config
523
export default defineConfig({
624
title: "Leaf",
725
description: "Performant fork of Paper",
8-
head: [["link", { rel: "icon", href: "/logo.svg" }]],
26+
head: [
27+
["link", { rel: "icon", href: "/logo.svg" }],
28+
...umamiScript,
29+
],
930

1031
vite: {
1132
css: {

0 commit comments

Comments
 (0)