diff --git a/src/components/spa-sidebar/spa-sidebar.mjs b/src/components/spa-sidebar/spa-sidebar.mjs index bf05dca..8043a18 100644 --- a/src/components/spa-sidebar/spa-sidebar.mjs +++ b/src/components/spa-sidebar/spa-sidebar.mjs @@ -178,8 +178,10 @@ document.addEventListener('DOMContentLoaded', () => { document.querySelector(`.event-page-sect#${initialSect}`).classList.add('active-sect'); } else { - // If no hash is present, set it based on the default active section (if any) - window.location.hash = document.querySelector('.event-page-sidebar-link.active').getAttribute('href'); + if(document.querySelector('.event-page-sidebar-link.active') !== null && document.querySelector('.event-page-sidebar-link.active').getAttribute('href') !== null) { + // If no hash is present, set it based on the default active section (if any) + window.location.hash = document.querySelector('.event-page-sidebar-link.active').getAttribute('href'); + } } if (!customElements.get('ba-spa-sidebar')) {