From c187f29e4bf99126e85afe57ab366c5eacc6050b Mon Sep 17 00:00:00 2001 From: Bob Vandevliet <35454011+bvandevliet@users.noreply.github.com> Date: Wed, 4 Feb 2026 17:24:17 +0100 Subject: [PATCH] Revert "Consistent linking, less confusing, partial revert of 0e82abef." This reverts commit 8a2835a13ec2c3658d65f49fcfa9709fc0bb294d. --- src/js/scripts.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/js/scripts.js b/src/js/scripts.js index 0788fdd..33fdd4a 100644 --- a/src/js/scripts.js +++ b/src/js/scripts.js @@ -44,6 +44,17 @@ document.addEventListener('DOMContentLoaded', () => // Update nav links and add anchor links to section headers. sectionsWithId.forEach(anchorTarget => { + // Navigate within current page if a section for the anchor exists. + navLinks.forEach(navLink => + { + const href = navLink.getAttribute('href'); + + if (href.startsWith('/#') && href.substring(2) === anchorTarget.id) + { + navLink.setAttribute('href', href.substring(1)); + } + }); + /** * @type {HTMLHeadingElement|null} */