diff --git a/attack-theme/static/scripts/sidebar-load-all.js b/attack-theme/static/scripts/sidebar-load-all.js index 0b274726817..e92a5e28a58 100644 --- a/attack-theme/static/scripts/sidebar-load-all.js +++ b/attack-theme/static/scripts/sidebar-load-all.js @@ -7,15 +7,20 @@ $("#sidebars").load(mod_entry, function() { let navElements = document.querySelectorAll('.sidenav-head > a'); let winlocation; navElements.forEach(function(element){ - if(!window.location.href.endsWith("/")){ - winlocation = window.location.href + "/"; + if(!element.href.includes('changelog.html')){ + if(!window.location.href.endsWith("/")){ + winlocation = window.location.href + "/"; + } + else{ + winlocation = window.location.href + } + if(!element.href.endsWith("/")){ + element.href = element.href + "/"; + } } else{ winlocation = window.location.href } - if(!element.href.endsWith("/")){ - element.href = element.href + "/"; - } if(element.href == winlocation){ $(element.parentNode).addClass("active") }}); @@ -35,7 +40,11 @@ $("#sidebars").load(mod_entry, function() { let sidenav = $(".sidenav-list"); let sidenav_active_elements = $(".sidenav .active"); if (sidenav_active_elements.length > 0) setTimeout(() => { //setTimeout gives bootstrap time to execute first - sidenav[0].scrollTop = sidenav_active_elements[0].offsetTop - 60; + let offsetValue = sidenav_active_elements[0].offsetTop; + if (offsetValue <= 0){ + offsetValue = sidenav_active_elements[sidenav_active_elements.length - 1].offsetTop; + } + sidenav[0].scrollTop = offsetValue - 60; }); }); diff --git a/data/resources_navigation.json b/data/resources_navigation.json index d2a191803e9..08a20f1c4b8 100644 --- a/data/resources_navigation.json +++ b/data/resources_navigation.json @@ -96,7 +96,7 @@ { "name": "Changelog", "id": "changelog", - "path": "/resources/changelog.html/", + "path": "/resources/changelog.html", "children": [] }, { diff --git a/modules/website_build/website_build_config.py b/modules/website_build/website_build_config.py index df383c09bf7..86512e1b851 100644 --- a/modules/website_build/website_build_config.py +++ b/modules/website_build/website_build_config.py @@ -71,4 +71,4 @@ website_build_templates_path = "modules/website_build/templates/" # CHANGELOG md -changelog_md = "Title: Changelog\n" "Template: website_build/changelog\n" "save_as: resources/changelog.html/\n\n" +changelog_md = "Title: Changelog\n" "Template: website_build/changelog\n" "save_as: resources/changelog.html\n\n"