Skip to content

Commit 0351598

Browse files
committed
"compress" breadcrumbs
1 parent bc18340 commit 0351598

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tools/importer/import.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ function getBreadcrumbs(html, pathname) {
3232
const urlPrefix = `${root}${pathname.substring(6)}`;
3333
let accumulatedUrl = '';
3434
const breadcrumbs = [];
35+
let lastMismatch;
3536
for (let i = 0; i < breadcrumbsArray.length; i += 1) {
3637
const currentElement = breadcrumbsArray[i];
3738
const breadcrumbsName = currentElement.name;
@@ -56,9 +57,15 @@ function getBreadcrumbs(html, pathname) {
5657
}
5758

5859
const currentElementUrl = new URL(currentElement.item);
59-
report.breadcrumbs_mismatch[accBreadcrumbs] = currentElementUrl.pathname.substring(6);
60+
const currentMismatch = currentElementUrl.pathname.substring(6);
61+
62+
if (lastMismatch !== currentMismatch) {
63+
report.breadcrumbs_mismatch[accBreadcrumbs] = currentMismatch;
64+
lastMismatch = currentMismatch;
65+
}
6066
}
6167
}
68+
6269
return breadcrumbs;
6370
}
6471

0 commit comments

Comments
 (0)