Do I have to explicitly define page resources for my leaf page bundle?

I have the following hierarchy in my content directory to emulate a headless leaf bundle:

Screen Shot 2021-08-17 at 10.21.44 AM

and the contents of my index.md file are:

---
headless: true
---

I’m trying to get all page resources in that leaf bundle named: homepage in my single page template with the following contents:

{ define "main" }}
{{ $headless := .Site.GetPage "homepage" }}
{{ $sections := $headless.Resources.Match "*" }}
<main class="content" role="main">
    {{ range $index_val, $elem_val := $sections }}
        <div>
            {{ $index_val }} -- {{ $elem_val }}
        </div>
    {{ end }}
</main>
{{ end }}

Unfortunately, I’m receiving an empty array of resources for that homepage bundle. Am I supposed to explicitly define the resources as a metadata in the index.md file of that bundle? I’m hoping to retrieve other page resources such as contact-us.

check the samples! this Match “*” does not work.

1 Like

Thanks, I just changed it to use ByType “page” function. Also in addition, I disabled other page kinds to only use page, and home kind as follows in config.toml file:

disableKinds = ["section", "taxonomy", "term"]

Then things started to work correctly.

Hello vsashidh, for sake of documentation, do realize ju52’s answer was the solution. Please mark it as such, though your feedback is appreciated, it’s a description of your particular problem or implementation. I almost missed the actual solution.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.