Access the resources of a parent folder

.Resources.GetMatch "feature" accesses the resource “feature” of the given content file.

Is it somehow possible to access the resources of a file in the parent folder?

I have a nested folder structure and would like to use the ressources of the parent folder in content files of subfolders.

This does not work:

resources:
- src: ../image.jpg
name: "feature"
title: "My Title"

An other approach would be to check in the html template if the content defines the resource feature and take the feature resource of the parent index.md if it does not.

Thanks for any hints
juh

Hugo has a concept of a “parent page”, which may be what you want (it relates to sections, but a bundled page’s parent also gets you what you want), e.g.

.Parent.Resources.GetMatch

1 Like