.range with where clause does not result in collection of .Page


I have a problem with this piece of code. The only output I see when performing a printf of the current context . inside the iteration is &hugolib.pageState. Where I would expect to go over a collection of .page objects as a result.

dir structure

└── paintings
    ├── 2020-01-15-a.md
    └── 2020-01-17-b.md

code snippet

  {{ range (where .Pages "Section" "paintings") }}
    <li>{{ printf "%#v" . }}</li>
  {{ end }}


&hugolib.pageState{pageOutputs:[]*hugolib.pageOutput{(*hugolib.pageOutput)(0xc000a038c0), (*hugolib.pageOutput)(0xc000a039e0)}, pageOutput:(*hugolib.pageOutput)(0xc000a038c0), pageCommon:(*hugolib.pageCommon)(0xc00068cf00)}

In stead of Section I also tried it with Type with the same outcome.
I would like to be able to iterate over the leafs in the paintings folder so I can generate a list of links so the user can drill down in the website.

Hi there,

Print out {{ . }} instead of {{ printf "%#v" . }}

try .Site.RegularPages instead of .Pages: https://gohugo.io/variables/site/#sitepages-compared-to-pages