When using a page bundle (i.e., a directory with a single index.md and some other files), the generated index.html will faithfully list all the other files under “Resources”.
However, if I have the files bar.md and resource.txt in one content directory, the generated file “bar/index.html” doesn’t show any resources. I also tried "src: ‘…/resource.txt’, no difference.
---
title: Bar
resources:
- src: 'resource.txt'
- name: 'MyResource'
---
This is the bar page. Where are my resources?
My questions:
Is it possible to have page resources outside a page bundle?
2a) If not, what’s the point of having a “resources” variable in the front page?
2b) if yes, how can I make hugo use them?
Of course I meant front matter. The docs say that I can configure page resourses like so, but whatever Iput into the “resources:” variable, the page’s .Resources is empty.
resources
used for configuring page bundle resources. See Page Resources.
Thanks for the hint with the headless bundle. How can I access the resources from the headless bundle?
I think you’re missing two key facts from Page Resources.
any page, including sections and the home page can have resources so the .Resources method always make sense.
A content directory will only become a page bundle if one of its md file is named index.md. This is how Hugo can know which md file is the Page itself, and which md files are just resources of given Page.
On top of the doc, you could check this blog post.
@pointyfar I’ve managed to use a headless bundle as repository for multiple resources that I can use from other pages, thanks
@regis: I think I understand what .Resources are, but I don’t understand what the “resources” variable accomplishes in the front matter, especially if “src” can’t point outside the current page bundle. But it doesn’t matter.