Left nav scroll to current page?

I am using the Hugo Learn Theme: Learn Theme for Hugo :: Documentation for Hugo Learn Theme

Is there a built in/easy way to have the Left nav scroll to current page? I frequently will click around the same sections, and itโ€™s a bit tedious having to scroll back to find what part of my site I am navigating within.

Rob
:slight_smile:

I recommend you raise an issue with the theme author:
https://github.com/matcornic/hugo-theme-learn/issues

1 Like

This seems to do the trick. I put it in my layouts/partials/custom-footer.html

<script>
   $(document).ready(function () {
      document.getElementsByClassName('ps-container')[0].scrollTop = 
            document.getElementsByClassName('active')[0].offsetTop;
   });
</script>

Rob
:slight_smile:

You could use my Relearn fork :wink:

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.