Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
32 changes: 17 additions & 15 deletions docs/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -80,22 +81,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: {
Expand Down
Loading