Skip to content

Commit e0dc375

Browse files
Fixed link issues
1 parent aba354f commit e0dc375

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

Courses/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ <h1 class="page-title">Courses</h1>
1616
<div class="courses-cards grid grid--3-cols">
1717
<!-- card 1 -->
1818

19-
<a href="JavaScript/index.html" class="courses-card">
19+
<a href="./JavaScript/index.html" class="courses-card">
2020
<img
2121
class="card-img"
2222
src="../assets/Images/Courses Banner/JavaScript.jpg"

assets/js/generateBreadcrumb.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,30 @@ function generateBreadCrumb() {
22
const breadCrumbContainer = document.getElementById("breadcrumb");
33
let pathArray = window.location.pathname.split("/").filter((p) => p);
44
const repoName = "javascript-course-notes";
5+
pathArray.unshift(repoName);
56

67
// If last segment is index.html, drop it
78
if (pathArray[pathArray.length - 1]?.toLowerCase() === "index.html") {
89
pathArray.pop();
910
}
1011

1112
let breadcrumbHTML = `
12-
<a href="/index.html">
13-
<img src="${repoName}/assets/Icons/monitor.png" style="width: 30px;"/>
13+
<a href="https://khalidrahmanhanify.github.io/${repoName}/index.html">
14+
<img src="https://khalidrahmanhanify.github.io/${repoName}/assets/Icons/monitor.png" style="width: 30px;"/>
1415
</a>
15-
<img src="${repoName}/assets/Icons/arrow_right.png" style="width: 20px; height: 20px;"/>
16+
<img src="https://khalidrahmanhanify.github.io/${repoName}/assets/Icons/arrow_right.png" style="width: 20px; height: 20px;"/>
1617
`;
1718

1819
let fullPath = "";
19-
pathArray.forEach((segment, index) => {
20-
if (segment === repoName) return;
20+
pathArray.forEach((segment) => {
2121
fullPath += `/${segment}`;
22+
if (segment === repoName) return;
2223

2324
breadcrumbHTML += `
2425
2526
`;
2627
breadcrumbHTML += `<a href="${fullPath}">${decodeURIComponent(segment)}</a>
27-
<img src="${repoName}/assets/Icons/arrow_right.png" style="width: 20px; height: 20px;"/>`;
28+
<img src="https://khalidrahmanhanify.github.io/${repoName}/assets/Icons/arrow_right.png" style="width: 20px; height: 20px;"/>`;
2829
});
2930
console.log(fullPath);
3031

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<nav class="breadcrumb" id="breadcrumb"></nav>
1313

1414
<h1>My Notes are available in this website click the following link</h1>
15-
<a href="Courses/index.html">Click to view them</a>
15+
<a href="./Courses/index.html">Click to view them</a>
1616
</body>
1717
<script src="assets/js/generateBreadcrumb.js"></script>
1818
</html>

0 commit comments

Comments
 (0)