Can we add homepage resources in a folder?

Hi
I have to store resources for homepage in content/media for content/_index.md which is using index.html layout. If I place images directly in content/ I can access them but I want them to be in a proper folder so they don’t mix with other content files and pages.

Another possible way: Can’t I simply make a folder like content/home and place _index.md and images in there which use index.html layout?

The homepage is a special page and no, it’s not possible to do it the way you envision.

But… Here is the way I would do it:

Create a page bundle somewhere (like content/home/homepage.md), then load it via getPage and use those resources in your home page layout.

And have a look at build options frontmatter so your “hidden” frontpage resources aren’t parsed and built like other pages.

2 Likes

Thanks! In my particular case case, .GetPage done even better.

My final solution:

{{ $imageResources := .Site.GetPage "/gallery" }}
{{ range $index, $value := $imageResources.Resources }}
...
{{ end }}

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