Retrieving .Content and .Params from section listing?

I have found https://discuss.gohugo.io/t/how-to-list-sections/1606 and https://discuss.gohugo.io/t/how-to-render-all-sections/1164 which outline how to list sections (such as in the index.html). But I can’t figure out how to get the .Content or .Params that is specified in the _index.md for the sections. Is there a way to also access everything for the sections index pages?

Section pages are list pages and not single-page templates.

So, for example…

<!--layouts/_default/section.html--> ?
<!--layouts/_default/list.html--> 
<!--In here do whatever you want for your section/index.html page-->
{{.Content}}
{{.Params.myparam}}

Look into the lookup order for list pages in Hugo. HTH.

Also check out .Site.GetPage function in the docs here:

http://gohugo.io/templates/functions/#site-getpage

I think maybe we are talking about two different things… I did not understand what you meant. But I actually figured this out and it was very simple.

It looks like Section pages have a Kind of “section”. The filter for the index.html became:

{{- range where .Site.Pages "Kind" "section" }}
<h4>{{ .Title }}</h4>
<a href="{{ .Params.external_link }}">Link</a>
<p>{{ .Summary }}</p>
{{ end }}

This will display all the section pages on the index.

Correct.

You asked for…

…the .Content or .Params that is specified in the _index.md

Right?

That’s the .GetPage function: http://gohugo.io/templates/functions/#site-getpage but that will just grab individual pages for sections; I think I misunderstood :smile: