It seems a simple question but I could not find reference to it in a lot of web searching. The most nearly on point was this “how to render all sections”.
My goal is to put a list of links to sections at the top of the page. Now, in this post I’m using the term “sections” for the first segment of the requested URL, after the domain name - please correct me if it’s the wrong term.
Imagine a site with these subdirectories in ‘content’:
blog
videos
reference
with some pages in each of those. I just want a list of links to the index (“list”) pages of those sections. Unlike the other poster above I do not want lists of pages in those sections - just the first part of the path as the url and the link text - for example looking like the list above, with links on those three strings (or whatever the section names are).
So I tried a modified version of the solution in the above post, as so:
<ul>{{ range $section := .Site.Sections }}
<li><a href="/{{ $section }}">{{ $section }}</li>{{ end }}
</ul>
However this gets the following:
- [WeightedPage(0,“about”)]
- [WeightedPage(0,“test page title here”)]
Also I’m wondering whether these sections are related to the default taxonomy “categories”.