Theme: How to get the list of sub-section in single.html

Updated: As I am not able to delete this post, I am updating it here.I think I managed to get what I want to achieve now. I will share it for feedback after I’ve done a few tests.

Thanks all!

Hello,

Let’s say I am following this page https://gohugo.io/content/sections/ to create a few nested section.

Example:

└── content
├── post
| ├── firstpost.md // <- http://1.com/post/firstpost/
| ├── happy
| | └── ness1.md // <- http://1.com/post/happy/ness1/
| | └── ness2.md // <- http://1.com/post/happy/ness2/

When I access http://1.com/post/firstpost/, I like to display the sub-sections which are under “happy”.

How do I get the list of sub-section from single.html?

I tried with this code below but I got the build error “ERROR: 2015/11/16 Error while rendering page post\happy\post\happy\ness2.md: reflect: call of reflect.Value.Type on zero Value

`Single.html

<h1>{{ .Title }}</h1>
	{{ .Content }}
	
{{ range  where .Data.Pages "Section" "happy" }}
	  <a href="{{ .Permalink }}">
		{{ .Title }}
	  </a>	
 {{ .Content }}
{{ end }}`

Is there any way to iterate the sub-sections from single.html under post?

Thanks!