if (page) {
    var ancestor = page
    while ((ancestor = ancestor.parentNode) && ancestor !== panel) {
      if (ancestor.className === 'nav-item') ancestor.classList.add('is-current-path', 'is-active')
    }
    page.classList.add('is-current-page', 'is-active')
    if (panel.scrollHeight > panel.clientHeight) {
      var panelRect = panel.getBoundingClientRect()
      var linkRect = page.querySelector('.nav-link').getBoundingClientRect()
      panel.scrollTop += Math.round(linkRect.top - panelRect.top -