How to access Resources outside page bundle?

I’ve written a primitive single.html template for testing purposes:

{{ range .Page.Resources }}
{{ .RelPermalink }} <br>
{{ end }}
{{ .Content }}

When using a page bundle (i.e., a directory with a single and some other files), the generated index.html will faithfully list all the other files under “Resources”.

However, if I have the files 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
- src: 'resource.txt'
- name: 'MyResource'
This is the bar page. Where are my resources?

My questions:

  1. 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?

Hi there,

  1. No.
    2a. Do you mean frontmatter? This is to manage your resources’ metadata.

As an alternative solution, you could put your “lose” resources into a headless bundle and get the resources for that page instead.

1 Like

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.


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?

Hey there,

I think you’re missing two key facts from Page Resources.

  1. any page, including sections and the home page can have resources so the .Resources method always make sense.
  2. A content directory will only become a page bundle if one of its md file is named 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.

1 Like

@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.