Skip to content

Commit 0509e26

Browse files
committed
Set BUILD_MODE=production for the Netlify production context
Caught by Cursor Bugbot on PR #1686. `astro.config.mjs` gates the Google Tag Manager snippet on `process.env.BUILD_MODE === 'production'`, but nothing in the Netlify config or the GitHub Actions docs-build workflow was setting the variable — so the production deploy of the docs site would silently ship without GTM, dropping analytics that the previous VuePress site had always loaded. Setting `BUILD_MODE = "production"` under `[context.production.environment]` is the right Netlify-native pattern: it only applies to deploys from the production branch, leaving PR deploy previews and branch deploys with `BUILD_MODE` unset so analytics doesn't fire on non-canonical URLs.
1 parent caa0673 commit 0509e26

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

netlify.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55
[build.environment]
66
NODE_VERSION = "22"
77

8+
# Production-context only: opts the build into the analytics + production
9+
# scripts that `astro.config.mjs` gates on `BUILD_MODE === 'production'`
10+
# (Google Tag Manager). PR deploy previews and other branch deploys keep
11+
# `BUILD_MODE` unset so analytics doesn't fire on non-canonical URLs.
12+
[context.production.environment]
13+
BUILD_MODE = "production"
14+
815
# The docs site is built with `base: '/docs'` in astro.config.mjs, so the
916
# generated HTML references `/docs/_astro/*`, `/docs/guide/*`, etc. In
1017
# production, `hyperformula.handsontable.com/docs/` is served by a reverse

0 commit comments

Comments
 (0)