From 8cc1c7cd719652a0bc994599435305f4d995dd33 Mon Sep 17 00:00:00 2001 From: Igor Lins e Silva <4753812+igorls@users.noreply.github.com> Date: Tue, 12 May 2026 18:51:47 -0300 Subject: [PATCH] feat(docs): wire MEMPALACE_DOCS_GA_ID into deploy and harden gtag snippet Pass the GA Measurement ID from the GitHub Actions repo variable into the docs build so the published site at mempalaceofficial.com actually emits the gtag tags. Also escape the ID via encodeURIComponent / JSON.stringify so a malformed value can't break the page. --- .github/workflows/deploy-docs.yml | 1 + website/.vitepress/config.mts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index db104883ea..6ba8f3bc94 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -44,6 +44,7 @@ jobs: env: DOCS_BASE: ${{ steps.pages.outputs.base_path }} DOCS_EDIT_BRANCH: ${{ github.ref_name }} + MEMPALACE_DOCS_GA_ID: ${{ vars.MEMPALACE_DOCS_GA_ID }} run: bun run docs:build - uses: actions/upload-pages-artifact@v5 diff --git a/website/.vitepress/config.mts b/website/.vitepress/config.mts index 47b69e25ee..679bc1a9ca 100644 --- a/website/.vitepress/config.mts +++ b/website/.vitepress/config.mts @@ -30,8 +30,8 @@ export default withMermaid( ['meta', { property: 'og:description', content: '96.6% LongMemEval recall. Zero API calls. Local, free, open source.' }], ['meta', { property: 'og:image', content: `${docsBase}mempalace_logo.png` }], ...(gaId ? [ - ['script', { async: '', src: `https://www.googletagmanager.com/gtag/js?id=${gaId}` }], - ['script', {}, `window.dataLayer = window.dataLayer || [];\nfunction gtag(){dataLayer.push(arguments);}\ngtag('js', new Date());\ngtag('config', '${gaId}');`], + ['script', { async: '', src: `https://www.googletagmanager.com/gtag/js?id=${encodeURIComponent(gaId)}` }], + ['script', {}, `window.dataLayer = window.dataLayer || [];\nfunction gtag(){dataLayer.push(arguments);}\ngtag('js', new Date());\ngtag('config', ${JSON.stringify(gaId)});`], ] as const : []), ],