Trying to make a section tree

I’m having a bit of trouble trying to make a section tree in the sidebar of my single pages. My content structure is currently like the below:
.
├── help
│ ├── hardware
│ │ ├── cpus.md
│ │ ├── videocards.md
│ │ ├── other.md
│ ├── software
│ │ ├── windows.md
│ │ ├── linux.md
│ │ ├── other.md
│ ├── misc.md
│ ├── extras.md
├── news
│ ├── article1.md
│ ├── article2.md
│ ├── article3.md

That being said, I have a layout/help/list.html and a layout/help/single.html

The list.html looks like this:
<ol>{{ range .Sections.ByParam “articlenum” }}
<li>{{ .Title }}
<ol>{{ range .Pages.ByParam “articlenum” }}
<li>{{ .Title }}</li>{{ end }}
</ol>
</li>{{ end }}
</ol>

This works great and gives me what I want, my titles in the format

  1. Hardware
    …1. CPUs
    …2. Video Cards
    …3. Other
  2. Software
    …1. Windows
    …2. Linux
    …3. Other

However, when I do it on single.html I get nothing. I assume this is due to the different context, but I can’t seem to figure out how to make it have the same type of display. I tried adding .Site to the front of the .Sections variable, but I then just get the following:

  1. Help
    …1. Misc
    …2. Extras

What am I missing to make single pages simply show everything like in the list.html?

Try $: Templating | Hugo

1 Like