Skip to content

Commit

Permalink
Merge pull request #4 from ontoportal-lirmm/feature/hide-doc-nav-icon…
Browse files Browse the repository at this point in the history
…-if-page-not-existent

Feature: Hide doc nav icon if page not existent
  • Loading branch information
Bilelkihal authored May 6, 2024
2 parents 4e5a32c + 7adc882 commit 58d0214
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions _includes/js/custom.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
document.addEventListener('DOMContentLoaded', function() {
const currentUrl = window.location.href;
document.querySelector(".nav-list").style.display = 'block'

// check if we are in the user guid tabs
if (currentUrl.includes('user_guide')) {
const parts = currentUrl.split('/');
Expand All @@ -22,10 +21,18 @@ document.addEventListener('DOMContentLoaded', function() {
}
}

console.log('execute')
// Remove the logo of the portal from the nav if it doesn't have the current page
const navLinks = Array.from(document.getElementById('ontoportal_tabs').querySelectorAll('a'));
navLinks.forEach(navLink => {
fetch(navLink.href)
.then(response => {
if (response.status === 404) {
navLink.remove();
}
});
});

} else {
document.querySelector(".breadcrumb-nav").style.display = 'block'

}

});

0 comments on commit 58d0214

Please sign in to comment.