diff --git a/src/helpers/is-last.js b/src/helpers/is-last.js deleted file mode 100644 index 032f167f..00000000 --- a/src/helpers/is-last.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict' - -module.exports = (item, array) => { - if (!item || !array) return false - if (!Array.isArray(array)) return false - return JSON.stringify(item) === JSON.stringify(array.slice(-1)[0]) -} diff --git a/src/js/01-nav.js b/src/js/01-nav.js index f72cfd4c..1f5aea50 100644 --- a/src/js/01-nav.js +++ b/src/js/01-nav.js @@ -15,10 +15,10 @@ }) } - // Open first nav collapse if none are open. - // Useful for pages with no nav links i.e. landing pages. const sideNav = document.querySelector('#side-nav') if (sideNav) { + // Open first nav collapse if none are open. + // Useful for pages with no nav links i.e. landing pages. const activeCollapses = sideNav.querySelectorAll('.collapse > .collapse-content.active') if (!activeCollapses.length) { const firstCollapse = sideNav.querySelector('.collapse > .collapse-content') @@ -26,6 +26,11 @@ firstCollapse.classList.add('active') } } + // Auto scroll the side nav to the current page's side nav link + const currentPageLink = sideNav.querySelector('.nav-link.current-page') + if (currentPageLink) { + currentPageLink.scrollIntoView({ block: 'center' }) + } } // Top Global Nav horizontal scrolling diff --git a/src/partials/breadcrumbs.hbs b/src/partials/breadcrumbs.hbs index 35234a0f..e22a9fd3 100644 --- a/src/partials/breadcrumbs.hbs +++ b/src/partials/breadcrumbs.hbs @@ -1,24 +1,28 @@ {{#unless (or (eq page.layout 'landing') (eq page.layout 'full') (eq page.layout 'home'))}} - +{{/if}} {{/unless}} diff --git a/src/partials/nav-tree.hbs b/src/partials/nav-tree.hbs index af0c8e1e..94bb3a87 100644 --- a/src/partials/nav-tree.hbs +++ b/src/partials/nav-tree.hbs @@ -5,7 +5,7 @@