Show the promo top banner only on production deploys (#3239)

This commit is contained in:
Paweł Kuna authored and GitHub committed 2026-09-29 20:35:08 +02:00
1 parent ad8c26aa4c
commit 7e447a2791
3 files changed
+13 -7

No files matched your search

+6
View File
@@ -0,0 +1,6 @@
---
"@tabler/preview": patch
"@tabler/docs": patch
---
Updated the promo top banner to load only on production deploys, not on branch previews.
+3 -3
View File
@@ -94,8 +94,8 @@ const pagePlugins = [...basePlugins, ...cssPlugins.filter((plugin) => !basePlugi
const environment = process.env.NODE_ENV || 'production';
// Vercel preview/branch deployments must not be indexed (VERCEL_ENV is unset locally).
const isVercelPreview = !!process.env.VERCEL_ENV && process.env.VERCEL_ENV !== 'production';
// The promo top banner loads on Vercel deploys (production and branch previews), never in local builds.
const isVercelDeploy = !!process.env.VERCEL_ENV;
// The promo top banner loads on Vercel production deploys only, never on branch previews or local builds.
const isProduction = process.env.VERCEL_ENV === 'production';
// Strip /docs prefix (and optional .html) for the docs namespace URL.
// Canonical form has no trailing slash (matching vercel.json trailingSlash: false);
@@ -525,6 +525,6 @@ const relatedPages = await Promise.all(
<PageScripts />
{isVercelDeploy && <script is:inline src="https://scripts.tabler.io/banner.js" defer data-tblr-ref="tabler-docs" />}
{isProduction && <script is:inline src="https://scripts.tabler.io/banner.js" defer data-tblr-ref="tabler-docs" />}
</body>
</html>
+4 -4
View File
@@ -33,9 +33,9 @@ const themeAttributes = themeDataAttributes(themeSettings)
const environment = process.env.NODE_ENV || 'production'
const isDevelopment = environment === 'development'
const min = isDevelopment ? '' : '.min'
// The promo top banner loads on Vercel deploys (production and branch previews),
// never in local builds or the packaged demo (VERCEL_ENV is unset there).
const isVercelDeploy = !!process.env.VERCEL_ENV
// The promo top banner loads on Vercel production deploys only, never on branch
// previews, local builds or the packaged demo (VERCEL_ENV is "preview" or unset there).
const isProduction = process.env.VERCEL_ENV === 'production'
// RTL swaps tabler/plugin stylesheets for their .rtl.css variants (demo stays LTR)
const rtlSuffix = rtl ? '.rtl' : ''
@@ -275,6 +275,6 @@ const libJsFiles = (head: boolean) => pageLibEntries.filter(([, lib]) => Boolean
</script>
<!-- END PAGE SCRIPTS -->
{isVercelDeploy && <script is:inline src="https://scripts.tabler.io/banner.js" defer data-tblr-ref="tabler-preview-top-banner" />}
{isProduction && <script is:inline src="https://scripts.tabler.io/banner.js" defer data-tblr-ref="tabler-preview-top-banner" />}
</body>
</html>