Page.Resources is always empty

I’m trying to have a series of posts each one with a different featured image and thought the Page Resources would be a nice way to do that, but I can’t get that to work.

I add the resources correctly in the post’s front matter but .Resources inside the template is always nil, though .Params.resources shows the data correctly.

I’ve made a minimal test project showing what I’m trying to do, there’s a single post test-post.md and its related featured image fall.jpg and a custom layout in layouts/_default/single.html.

hugo server returns no errors.

git clone https://github.com/Alien1993/hugo-testing-resources && cd hugo-testing-resources && git submodule init and you’re ready to go.

$ hugo env
Hugo Static Site Generator v0.53/extended linux/amd64 BuildDate: unknown
GOOS=“linux”
GOARCH=“amd64”
GOVERSION=“go1.11.4”

Hi,

You need to turn your test-post.md into a page bundle: https://gohugo.io/content-management/page-bundles/

Then put the related featured image inside the bundle.

1 Like

Thanks, it worked.