diff --git a/libs/navigation/footer.js b/libs/navigation/footer.js index f0d310d28e..bfd173cfc0 100644 --- a/libs/navigation/footer.js +++ b/libs/navigation/footer.js @@ -4,22 +4,25 @@ const blockConfig = { appendType: 'appendChild', }; -async function loadBlock() { - const { fedsGlobalConfig = {} } = window; - const miloLibs = fedsGlobalConfig.miloLibs || 'https://www.adobe.com'; +export default async function loadBlock(configs = {}) { + let miloLibs = configs.miloLibs || 'https://www.adobe.com'; + const branch = new URLSearchParams(window.location.search).get('branch'); + if (branch) { + miloLibs = `https://${branch}--milo--adobecom.hlx.page` + } + const { locale, contentRoot} = configs; // Relative path can't be used, as the script will run on consumer's app const { default: bootstrapBlock } = await import(`${miloLibs}/libs/navigation/bootstrapper.js`); const { default: locales } = await import(`${miloLibs}/libs/utils/locales.js`); const clientConfig = { + contentRoot, origin: miloLibs, - contentRoot: fedsGlobalConfig.contentRoot, miloLibs: `${miloLibs}/libs`, - pathname: `/${fedsGlobalConfig.locale || ''}`, - locales: fedsGlobalConfig.locales || locales, + pathname: `/${locale || ''}`, + locales: configs.locales || locales, }; bootstrapBlock(clientConfig, blockConfig); } -loadBlock();