I have this JSON file I am using to create posts for a search page based on this guide. Inside the posts folder, I would like to either limit the posts shown by type: post or exclude a folder inside content/posts called ‘views’. I would appreciate some help on how to rework this code to achieve that. Thanks in advance.
[
{{- with $.Site.GetPage "/posts" }}
{{- range $index, $data := .Pages }}
{{- if $index }},{{ end }}
{
"title": "{{ $data.Title }}",
"url": "{{ $data.RelPermalink }}"
}
{{- end }}
{{- end }}
]
Thanks! This was not displaying any results $pages := where .Pages "Section" "!=" "views" only displaying folder names that weren’t excluded. This is the part I needed {{- range $index, $data := $pages }} and used {{ $pages := where site.RegularPages "Type" "posts"}} . All solved now.