feat: add disable prop to docusaurus-fathom

This commit is contained in:
jinhojang6
2023-09-20 00:26:33 +09:00
parent a25c560994
commit 096ddcf54d
3 changed files with 13 additions and 2 deletions
@@ -1,4 +1,5 @@
export type PluginOptions = {
siteId: string
scriptUrl: string
disabled?: boolean
}
+4 -2
View File
@@ -7,7 +7,8 @@ export default function fathomPlugin(
context: LoadContext,
options: PluginOptions,
): Plugin<undefined> {
const { siteId, scriptUrl } = options
const { siteId, scriptUrl, disabled = false } = options
const dir = path.join(context.generatedFilesDir, 'docusaurus-fathom/default')
fs.ensureDirSync(dir)
@@ -18,7 +19,8 @@ export default function fathomPlugin(
return {
name: 'docusaurus-fathom',
getClientModules: () => [path.resolve(__dirname, './client/index.js')],
getClientModules: () =>
disabled ? [] : [path.resolve(__dirname, './client/index.js')],
}
}
@@ -69,6 +69,14 @@ const config = {
authorsMapPath: 'authors.yml',
}),
],
[
'@acid-info/docusaurus-fathom',
{
siteId: 'TEST',
scriptUrl: 'https://fathom.status.im/tracker.js',
disabled: true,
},
],
],
themeConfig: