Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reset breadcrumbs when loading a new product #510

Merged
merged 1 commit into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions index-ca-en.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@
document.addEventListener('Storylines-Loaded', (payload) => {
const breadcrumbs = payload.detail.config.breadcrumbs ?? []; // default to an empty array if this property isn't defined.
const breadcrumbList = document.querySelectorAll('#wb-bc > .container > .breadcrumb')[0];
const firstElement = breadcrumbList.children[0]; // should be the `Canada.ca` breadcrumb.

// Reset the breadcrumb list.
breadcrumbList.innerHTML = ``;

// Add the `Canada.ca` element back to the list of breadcrumbs.
breadcrumbList.appendChild(firstElement);

// Create an HTML li element for each of the breadcrumbs to add and then append them to the breadcrumb list.
breadcrumbs.forEach((b) => {
Expand Down
9 changes: 8 additions & 1 deletion index-ca-fr.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,15 @@
});

document.addEventListener('Storylines-Loaded', (payload) => {
const breadcrumbs = payload.detail.config.breadcrumbs;
const breadcrumbs = payload.detail.config.breadcrumbs ?? []; // default to an empty array if this property isn't defined.
const breadcrumbList = document.querySelectorAll('#wb-bc > .container > .breadcrumb')[0];
const firstElement = breadcrumbList.children[0]; // should be the `Canada.ca` breadcrumb.

// Reset the breadcrumb list.
breadcrumbList.innerHTML = ``;

// Add the `Canada.ca` element back to the list of breadcrumbs.
breadcrumbList.appendChild(firstElement);

// Create an HTML li element for each of the breadcrumbs to add and then append them to the breadcrumb list.
breadcrumbs.forEach((b) => {
Expand Down
Loading