Skip to content

Commit

Permalink
docs: Add scripting on deploy for plausible analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
FoxxMD committed Jun 12, 2024
1 parent 5d35b04 commit 1c38c8a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .github/workflows/docsDeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- master
- developDocs
# Review gh actions docs if you want to further define triggers, paths, etc
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on

Expand All @@ -22,6 +23,9 @@ jobs:
run: npm ci
working-directory: ./docsite
- name: Build website
env:
ANALYTICS: ${{ secrets.ANALYTICS }}
ANALYTICS_DOMAIN: ${{ secrets.ANALYTICS_DOMAIN }}
run: npm run build
working-directory: ./docsite

Expand Down
13 changes: 12 additions & 1 deletion docsite/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ const config = {
defaultLocale: 'en',
locales: ['en'],
},

scripts: [
],
presets: [
[
'classic',
Expand Down Expand Up @@ -156,4 +157,14 @@ const config = {
}),
};

if (process.env.ANALYTICS !== undefined && process.env.ANALYTICS !== '') {
const script = {
src: process.env.ANALYTICS,
}
if (process.env.ANALYTICS_DOMAIN !== undefined && process.env.ANALYTICS_DOMAIN !== '') {
script['data-domain'] = process.env.ANALYTICS_DOMAIN;
}
config.scripts.push(script)
}

module.exports = config;

0 comments on commit 1c38c8a

Please sign in to comment.