I've been working with my partner [Nikki](https://twitter.com/nyx_photography) recently to build her a small website she can use as a knowledge base for all her witch-y stuff. This includes tarot, herbalism, naturism, etc. She couldn't find a decent CMS that met all the features that she wanted, or at least one that wouldn't be a pain in the arse to get working. By the end of her searches she had settled on just making her own static pages in HTML and CSS when I suggested [Hugo](https://gohugo.io/). The output would be the same, but you get access to a lot of extra features to make developing it a lot easier. One of the things she wanted was a sidebar menu that displayed all the [section](https://gohugo.io/content-management/sections/) links in her site. Her site is particularly in-depth and contains many categories (sections) which themselves can contain more sub-categories (sub-sections), in a hierarchical fashion. Thankfully Hugo handles the content and link generation side of this really easily, you can just create more directories inside directories and the default link structure Just Works™. To solve the issue with the sidebar though, we turned to one of my favourite lessons from [functional programming](https://www.goodreads.com/book/show/18669296-becoming-functional); recursion. To build the sidebar, we created two partials. The first, `sidebar.html` was imported directly into our header template and looks like this: {{< highlight html >}} {{< / highlight >}} The second section is of course called `sidebar-recurse.html` and looks like the following: {{< highlight html >}}