# Creating a menu for all Nested Sections within a Section

**URL:** <https://discourse.gohugo.io/t/creating-a-menu-for-all-nested-sections-within-a-section/8049>\
**Category:** tips & tricks\
**Created:** [August 20, 2017, 9:23pm UTC](https://discourse.gohugo.io/t/creating-a-menu-for-all-nested-sections-within-a-section/8049 "2017-08-20T21:23:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexandros](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexandros](https://discourse.gohugo.io/u/alexandros)\
**Post date:** [August 20, 2017, 9:23pm UTC](https://discourse.gohugo.io/t/creating-a-menu-for-all-nested-sections-within-a-section/8049/1 "2017-08-20T21:23:30Z")

</div>

Spent a bit of time on this. After reading quite a few topics, checking out the demo at [bepsays.com](http://hugotest.bep.is/) and trying out several things.

This is by far the simplest way to create a Nested Sections menu without the regular pages permalinks.

> ```
> {{ range .Sections }}
> <a href="{{ .Permalink }}">{{ .Title | upper }}</a>
> {{end}}
> 
> ```

If you have an even better way of doing this please share.

**EDIT**  
The above menu renders only on the Main Section list and not on the Nested Sections list pages.

Now here is how to make a Nested Sections Menu appear everywhere within a Section.

> ```
> {{ range (.Site.GetPage "section" .Section).Sections }}
> <li><a href="{{ .Permalink }}">{{ .Title | upper }}</a></li>
> {{end}}
> 
> ```

Thanks to @budparr for [this](https://discourse.gohugo.io/t/method-for-calling-a-nested-sections-title/7272)

* * *

**EDIT**

The above stopped working in Hugo 0.45 after the revision of the `.GetPage` API.

But with the help of @kaushalmodi in [Panic Error with .GetPage in Hugo 0.45 - #2 by kaushalmodi](https://discourse.gohugo.io/t/panic-error-with-getpage-in-hugo-0-45/13116/2) here is the revised code snippet to have this functionality in Hugo 0.45.

```auto
{{ with .Site.GetPage (printf "/%s" .Section) }} 
{{ $sections := .Sections }}
{{ range where $sections }}
<li><a href="{{ .Permalink }}">{{ .Title }}</a></li>
{{ end }}
{{end}}

```

---

<div class="post-metadata">

**Author:** ![KalikaKay](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/kalikakay/32/5894_2.png) [@KalikaKay](https://discourse.gohugo.io/u/KalikaKay)\
**Post date:** [May 9, 2018, 8:20pm UTC](https://discourse.gohugo.io/t/creating-a-menu-for-all-nested-sections-within-a-section/8049/2 "2018-05-09T20:20:12Z")

</div>

_I had to search for this one and the thought didn’t occur to me to look up the word “Section” when I want to display the title of a folder until I started to try and build my own theme._

Below is the index.html file. It displays the available sections or folders accessible from the home page.

 ![Capture](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/2X/7/717cc12035d681f73fc103555c4f03e8b0c09032.JPG)

Here is a list.html template file. It lists the section/folder titles in a section.

 ![Capture2](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/2X/0/021b77146e8f5daf929a19d23f88d682227988aa.JPG)

**Reiterations**

- To display content on your home level \_index.md file, you need to include {{ .Content }} in your index.html file.
- To display the content on your sub level \_index.md files, you need to includ {{ .Content }} in your list.hml files.
- By design: the above ONLY displays the section titles. It does NOT display nested sections.
