mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-14 00:32:47 +02:00
fix(migrate): migration CLI should correctly migrate gtag options (#6276)
* fix(migrate): migration CLI should correctly migrate gtag options * fix
This commit is contained in:
parent
4efdd33df9
commit
1d957d97e8
5 changed files with 70 additions and 37 deletions
|
@ -247,6 +247,7 @@ export function createConfigFile({
|
|||
'enableUpdateBy',
|
||||
'docsSideNavCollapsible',
|
||||
'gaTrackingId',
|
||||
'gaGtag',
|
||||
];
|
||||
const value = siteConfig[key as keyof typeof siteConfig];
|
||||
if (value !== undefined && !knownFields.includes(key)) {
|
||||
|
@ -293,6 +294,15 @@ export function createConfigFile({
|
|||
},
|
||||
blog: {},
|
||||
theme: {},
|
||||
...(() => {
|
||||
if (siteConfig.gaTrackingId) {
|
||||
if (siteConfig.gaGtag) {
|
||||
return {gtag: {trackingID: siteConfig.gaTrackingId}};
|
||||
}
|
||||
return {googleAnalytics: {trackingID: siteConfig.gaTrackingId}};
|
||||
}
|
||||
return undefined;
|
||||
})(),
|
||||
},
|
||||
],
|
||||
],
|
||||
|
@ -351,11 +361,6 @@ export function createConfigFile({
|
|||
},
|
||||
},
|
||||
algolia: siteConfig.algolia ? siteConfig.algolia : undefined,
|
||||
gtag: siteConfig.gaTrackingId
|
||||
? {
|
||||
trackingID: siteConfig.gaTrackingId,
|
||||
}
|
||||
: undefined,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue