File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -4,17 +4,21 @@ function generateBreadCrumb() {
44 // Split the pathname into parts
55 let pathArray = window . location . pathname . split ( "/" ) . filter ( ( p ) => p ) ;
66
7- const repoName = pathArray . length > 0 ? pathArray [ 0 ] : "courses-notes" ;
7+ // Detect repo name (first segment)
8+ const repoName = pathArray . length > 0 ? pathArray [ 0 ] : "" ;
89 const basePath = `/${ repoName } ` ;
910
10- pathArray . shift ( ) ;
11+ // Remove repo name from breadcrumb segments
12+ if ( repoName ) {
13+ pathArray . shift ( ) ;
14+ }
1115
1216 // If last segment is index.html, drop it
1317 if ( pathArray [ pathArray . length - 1 ] ?. toLowerCase ( ) === "index.html" ) {
1418 pathArray . pop ( ) ;
1519 }
1620
17- // Start breadcrumb with monitor icon (link to repo root)
21+ // Start breadcrumb with monitor icon (always links to repo root index.html )
1822 let breadcrumbHTML = `
1923 <a href="${ basePath } /index.html">
2024 <img src="${ basePath } /assets/Icons/monitor.png" style="width: 30px;"/>
@@ -26,9 +30,10 @@ function generateBreadCrumb() {
2630 fullPath += `/${ segment } ` ;
2731 const isLast = index === pathArray . length - 1 ;
2832
29- breadcrumbHTML += `
30- <img src="${ basePath } /assets/Icons/arrow_right.png" style="width: 20px; height: 20px;"/>
31- ` ;
33+ // Add arrow only if it's not the last segment
34+ breadcrumbHTML += isLast
35+ ? " "
36+ : `<img src="${ basePath } /assets/Icons/arrow_right.png" style="width: 20px; height: 20px;"/>` ;
3237
3338 if ( ! isLast ) {
3439 breadcrumbHTML += `<a href="${ basePath } ${ fullPath } ">${ decodeURIComponent (
You can’t perform that action at this time.
0 commit comments