I want to render all the markdown files inside every folder except the static one in my home page of the website, one way of doing that is by using union in hugo, but as number of folders increase, I see myself repeating unions all over the place (code with union is commented, which is working by the way), so I thought using a slice would be a better idea, but when I try to use slice, I get the following error -
failed to render pages: render of "home" failed: "(Directory Path)\layouts\index.html:12:19": execute of template failed at <.Pages>: can’t evaluate field Pages in type string
directory structure
code for index.html
{{ define "main" }}
<ul class="homepage-topic-sections-container">
{{$sectionNames := slice "posts" "problems" "tutorials"}}
{{range $index, $sectionName := $sectionNames}}
{{ range where .Pages "Section" $sectionName }}
{{/*
{{ range union (union
(where .Pages "Section" "posts")
(where .Pages "Section" "problems"))
(where .Pages "Section" "tutorials")
}}
*/}}
<li>
<section class="homepage-topic-section">
<h1 class="topic-heading"><a href="{{.Permalink}}">{{.Title}} </a></h1>
<div>
{{ range .Pages }}
<h3><a href="{{.Permalink}}">{{.Title}} · {{.Date.Format "January 2, 2006"}}</a></h3>
{{ end }}
</div>
</section>
</li>
{{end}}
{{end}}
</ul>
{{ end }}