Skip to content

Commit

Permalink
Adding redirect uri in meta
Browse files Browse the repository at this point in the history
  • Loading branch information
bandana147 committed Aug 5, 2024
1 parent c2d74db commit 36cde88
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
15 changes: 11 additions & 4 deletions libs/navigation/bootstrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,17 @@ export default async function bootstrapBlock(miloLibs, blockConfig) {
const block = createTag(targetEl, { class: name });
document.body[blockConfig.appendType](block);
}
// Configure Unav if unav components are in configs
if (blockConfig.targetEl === 'header' && blockConfig.unavComponents) {
const unavMeta = createTag('meta', { name: 'universal-nav', content: blockConfig.unavComponents });
document.head.append(unavMeta);
// Configure Unav components and redirect uri
if (blockConfig.targetEl === 'header') {
['unavComponents', 'redirect'].forEach((key) => {
if (blockConfig[key]) {
const metaTag = createTag('meta', {
name: key === 'unavComponents' ? 'universal-nav' : 'adobe-home-redirect',
content: blockConfig[key],
});
document.head.append(metaTag);
}
});
}

initBlock(document.querySelector(targetEl));
Expand Down
2 changes: 1 addition & 1 deletion libs/navigation/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default async function loadBlock(configs, customLib) {
if (configBlock) {
bootstrapBlock(`${miloLibs}/libs`, {
...block,
...(block.key === 'header' && { unavComponents: configBlock.unavComponents }),
...(block.key === 'header' && { unavComponents: configBlock.unavComponents, redirect: configBlock.redirect }),
});
}
});
Expand Down

0 comments on commit 36cde88

Please sign in to comment.