Skip to content

Commit 8d9c1ee

Browse files
authored
feat: add segment to docuaurus (#2247)
1 parent df6fd6c commit 8d9c1ee

File tree

3 files changed

+1866
-81
lines changed

3 files changed

+1866
-81
lines changed

docusaurus.config.js

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,16 @@ const redirectPlugin = [
4848
// @ts-ignore - types don't understand the plugin config
4949
plugins.push(redirectPlugin)
5050

51+
const segmentPlugin = ["@twilio-labs/docusaurus-plugin-segment",
52+
{
53+
writeKey: "tVYixAoRAiTy0O7hBkB2TH2hMWFm0IW4",
54+
allowedInDev: false,
55+
}
56+
];
57+
58+
// @ts-ignore - types don't understand the plugin config
59+
plugins.push(segmentPlugin);
60+
5161
/** @type {import('@docusaurus/types').FasterConfig} */
5262
const fasterConfig = {
5363
rspackBundler: true,
@@ -213,8 +223,8 @@ const config = {
213223
},
214224
googleTagManager: enableGoogleAnalytics
215225
? {
216-
containerId: googleAnalyticsConfig.trackingID,
217-
}
226+
containerId: googleAnalyticsConfig.trackingID,
227+
}
218228
: undefined,
219229
},
220230
],
@@ -424,20 +434,20 @@ const config = {
424434
},
425435
algolia: algoliaConfig
426436
? {
427-
appId: algoliaConfig.appId,
428-
// Public API key: safe to commit, but still sourced from config
429-
apiKey: algoliaConfig.apiKey,
430-
indexName: algoliaConfig.indexName,
431-
libraryIndexName: algoliaConfig.libraryIndexName,
432-
contextualSearch: true,
433-
}
437+
appId: algoliaConfig.appId,
438+
// Public API key: safe to commit, but still sourced from config
439+
apiKey: algoliaConfig.apiKey,
440+
indexName: algoliaConfig.indexName,
441+
libraryIndexName: algoliaConfig.libraryIndexName,
442+
contextualSearch: true,
443+
}
434444
: undefined,
435445
zoomSelector: ".markdown :not(em) > img:not(.no-zoom)",
436446
posthog: enablePosthog
437447
? {
438-
apiKey: posthogConfig.apiKey,
439-
appUrl: posthogConfig.appUrl,
440-
}
448+
apiKey: posthogConfig.apiKey,
449+
appUrl: posthogConfig.appUrl,
450+
}
441451
: undefined,
442452
metadata: [
443453
// https://docusaurus.io/docs/2.x/seo#global-metadata

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"@docusaurus/theme-mermaid": "^3.6.0",
3333
"@mdx-js/react": "^3.0.1",
3434
"@svgr/webpack": "^5.5.0",
35+
"@twilio-labs/docusaurus-plugin-segment": "^0.1.0",
3536
"@types/jest": "^27.4.0",
3637
"algoliasearch": "^5.12.0",
3738
"buffer": "^6.0.3",

0 commit comments

Comments
 (0)