In my previous version of the auto-collapsing (nested) menu I chose to avoid Hugo’s subsections. However, due to an update of the breadcrumbs, I was motived to test the possibility to create a nested menu based on sections and subsections. I succeeded and the code became much cleaner/shorter and simpler, especially due to the ‘.Ancestors’ variable. The way to determine if a page is ‘active’ is done through the following code: