Skip to content

Commit 91eb249

Browse files
committed
OpenCodeLaw: fix artcle id's in nav and url
Signed-off-by: kiranpranay <[email protected]>
1 parent 942c23e commit 91eb249

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

js/opencodelaw.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ fetch("specs/opencon.yaml")
8989
// navLi.classList.add("heading");
9090
const navLink = document.createElement("a");
9191
navLink.classList.add("nav-a");
92-
navLink.href = `#article${index + 1}`;
92+
navArticleId = navLink.href = `#article${index + 1}`;
9393
navLink.textContent = article.title;
9494
navLi.appendChild(navLink);
9595
navUl.appendChild(navLi);
@@ -113,7 +113,7 @@ fetch("specs/opencon.yaml")
113113
navSectionSubLi.classList.add("nav-list");
114114
const navSectionSubLink = document.createElement("a");
115115
navSectionSubLink.classList.add("nav-a");
116-
navSectionSubLink.href = `#article${article.id}-section${index + 1}`;
116+
navSectionSubLink.href = `${navArticleId}/section${index + 1}`;
117117
navSectionSubLink.textContent = `${index + 1}. ${section.title}`;
118118
navSectionSubLi.appendChild(navSectionSubLink);
119119
navSectionUl.appendChild(navSectionSubLi);
@@ -160,7 +160,7 @@ fetch("specs/opencon.yaml")
160160
articleContainer.classList.add("article-container");
161161
containerMainContentArticle.appendChild(articleContainer);
162162
const articleContainerH2 = document.createElement("h2");
163-
articleContainerH2.id = `article${index + 1}`;
163+
const articleId = (articleContainerH2.id = `article${index + 1}`);
164164
articleContainerH2.classList.add("heading-secondary");
165165
articleContainerH2.textContent = `${index + 1}. ${article.title}`;
166166
articleContainer.appendChild(articleContainerH2);
@@ -175,7 +175,7 @@ fetch("specs/opencon.yaml")
175175
articleContainer.appendChild(sectionContainer);
176176
sections.forEach((section, index) => {
177177
const sectionContainerH3 = document.createElement("h3");
178-
sectionContainerH3.id = `article${article.id}-section${index + 1}`;
178+
sectionContainerH3.id = `${articleId}/section${index + 1}`;
179179
sectionContainerH3.classList.add("heading-secondary");
180180
sectionContainerH3.textContent = `${index + 1}. ${section.title}`;
181181
sectionContainer.appendChild(sectionContainerH3);

0 commit comments

Comments
 (0)