Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

docs: load Plausible on invoke.ai (custom), not ghpages (#9161)

Alexander Eichhorn993c68102f19
diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml
index c80b69bc2a..8c4a477fe9 100644
--- a/.github/workflows/deploy-docs.yml
+++ b/.github/workflows/deploy-docs.yml
@@ -116,6 +116,8 @@ jobs:
working-directory: docs
env:
DEPLOY_TARGET: ${{ github.event_name == 'workflow_dispatch' && inputs.deploy_target || 'custom' }}
+ ENABLE_ANALYTICS: ${{ github.ref == 'refs/heads/main' && (github.event_name != 'workflow_dispatch' ||
+ inputs.deploy_target == 'custom') }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: verify deploy output
diff --git a/docs/astro.config.mjs b/docs/astro.config.mjs
index ee71f3726a..35333bc0c6 100644
--- a/docs/astro.config.mjs
+++ b/docs/astro.config.mjs
@@ -14,6 +14,7 @@ import starlightContextualMenu from 'starlight-contextual-menu';
// so the same source can be deployed to either target.
const deployTarget = process.env.DEPLOY_TARGET ?? 'custom';
const isGhPages = deployTarget === 'ghpages';
+const enableAnalytics = process.env.ENABLE_ANALYTICS === 'true';
const base = isGhPages ? '/InvokeAI' : '';
const withBase = (/** @type {string} */ path) => (isGhPages ? `${base}${path}` : path);
@@ -82,22 +83,23 @@ export default defineConfig({
editLink: {
baseUrl: 'https://github.com/invoke-ai/InvokeAI/edit/main/docs',
},
- head: isGhPages
- ? [
- {
- tag: 'script',
- attrs: {
- async: true,
- src: 'https://plausible.tracking.events/js/pa-BHcumuOemKz4XIQeWkTn4.js',
+ head:
+ enableAnalytics && !isGhPages
+ ? [
+ {
+ tag: 'script',
+ attrs: {
+ async: true,
+ src: 'https://plausible.tracking.events/js/pa-BHcumuOemKz4XIQeWkTn4.js',
+ },
},
- },
- {
- tag: 'script',
- content:
- 'window.plausible=window.plausible||function(){(plausible.q=plausible.q||[]).push(arguments)},plausible.init=plausible.init||function(i){plausible.o=i||{}};plausible.init()',
- },
- ]
- : [],
+ {
+ tag: 'script',
+ content:
+ 'window.plausible=window.plausible||function(){(plausible.q=plausible.q||[]).push(arguments)},plausible.init=plausible.init||function(i){plausible.o=i||{}};plausible.init()',
+ },
+ ]
+ : [],
defaultLocale: 'root',
locales: {
root: {