I need help with accessing a nested section in a headless bundle.
My content structure:
content
|––products
|––index.md
|––items [layout = "items"]
|––index.md
|––categories
|–––index.md [headless = true]
|–––category1.md
|–––category2.md
|––data
|–––index.md [headless = true]
|–––data1.md
|–––data2.md
In layouts > products > items.html
The following gives all pages in categories
and data
.
{{$headlessbundle := .Site.GetPage "products/items"}}
{{range ( $headlessbundle.Resources.ByType "page" )}}
{{.}}
{{end}}
But if I only want to get the pages from data
, and I change the path:
{{$headlessbundle := .Site.GetPage "products/items/data"}}
{{range ( $headlessbundle.Resources.ByType "page" )}}
{{.}}
{{end}}
I get the following error message:
<$headlessbundle.Reso...>: can't evaluate field Resources in type *hugolib.Page
How do I access the pages only from data
?