Skip to content

Commit

Permalink
"compress" breadcrumbs
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcarol committed Oct 24, 2024
1 parent bc18340 commit 0351598
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tools/importer/import.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ function getBreadcrumbs(html, pathname) {
const urlPrefix = `${root}${pathname.substring(6)}`;
let accumulatedUrl = '';
const breadcrumbs = [];
let lastMismatch;
for (let i = 0; i < breadcrumbsArray.length; i += 1) {
const currentElement = breadcrumbsArray[i];
const breadcrumbsName = currentElement.name;
Expand All @@ -56,9 +57,15 @@ function getBreadcrumbs(html, pathname) {
}

const currentElementUrl = new URL(currentElement.item);
report.breadcrumbs_mismatch[accBreadcrumbs] = currentElementUrl.pathname.substring(6);
const currentMismatch = currentElementUrl.pathname.substring(6);

if (lastMismatch !== currentMismatch) {
report.breadcrumbs_mismatch[accBreadcrumbs] = currentMismatch;
lastMismatch = currentMismatch;
}
}
}

return breadcrumbs;
}

Expand Down

0 comments on commit 0351598

Please sign in to comment.