This is a partial to list current directory structure aka: sections when included in any directory inside /content
or an arbitrary depth nested section:
<div>
<ul>
{{ if ne .IsHome true }}
<h4>Articles:</h4>
{{ template "current-section_pages" . }}
{{end}}
<hr>
{{ if gt (len .Sections) 0}}
<h4>Subcategories</h4>
{{ template "section-tree-nav" . }}
{{end}}
</ul>
</div>
{{ define "section-tree-nav" }}
{{ range .Sections }}
<li><h5><a href="{{.Permalink}}">{{ .LinkTitle }}</a></h5> </li>
{{ template "current-section_pages" . }}
<ul>
{{ template "section-tree-nav" . }}
</ul>
{{ end }}
{{ end }}
{{ define "current-section_pages" }}
<ul>
{{ range .Pages }}
<li><a href="{{ .Permalink}}"> {{ .LinkTitle }} </a></li>
{{ end }}
</ul>
{{ end }}
To use it simply include the partial in your layout {{ partial "sections-tree.html" . }}
It is a modified version of: https://github.com/bep/hugotest/blob/master/layouts/partials/sections-tree.html that shows current section/nested section articles and then a tree of the subdirectories with their articles.
I am currently using it at the SimpleIT theme: https://github.com/marcanuy/simpleit-hugo-theme/
And you can see it in action here: https://marcanuy.github.io/simpleit-hugo-theme/
Partial file: https://github.com/marcanuy/simpleit-hugo-theme/blob/master/layouts/partials/sections-tree.html