Skip to content

Commit 8eb31ea

Browse files
Updated the breadcrumb generation
1 parent a39429b commit 8eb31ea

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

assets/js/generateBreadcrumb.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
function generateBreadCrumb() {
22
const breadCrumbContainer = document.getElementById("breadcrumb");
33

4-
// Get path parts
4+
// Split the pathname into parts
55
let pathArray = window.location.pathname.split("/").filter((p) => p);
66

7+
// Detect repo name (first part of GitHub Pages URL)
78
const repoName = pathArray.length > 0 ? pathArray[0] : "";
89
const basePath = `/${repoName}`;
910

10-
// Drop the repo name so breadcrumb starts clean
11+
// Drop repo name from breadcrumb display
1112
if (repoName) {
1213
pathArray.shift();
1314
}
@@ -17,7 +18,7 @@ function generateBreadCrumb() {
1718
pathArray.pop();
1819
}
1920

20-
// Start breadcrumb with home icon
21+
// Start breadcrumb with monitor icon (link to repo root)
2122
let breadcrumbHTML = `
2223
<a href="${basePath}/index.html">
2324
<img src="${basePath}/assets/Icons/monitor.png" style="width: 30px;"/>

0 commit comments

Comments
 (0)