Content files without corresponding urls possible?


#1

So I’m new to Hugo, just trying to figure out the best way to do this:

On one page of my website I want an image gallery. I’m trying to use content files in a /content/gallery/ folder, with front matter linking to and describing each image (for alt-text, CSS purposes, etc.). I was wondering if there’s a way to keep Hugo from generating HTML files for these gallery content files, since all I want is to display them all on my image gallery page, and I won’t really link to the individual pages.

Perhaps I’m just going about this the wrong way?


#2

You can use data files for this. See the Hugo Agency theme for an example.

The new Page Bundles won’t do what you need for your index as at that level currently there is support only for images.


#3

Awesome, I’ll look into that. Thanks!


#4

Just a sec. If what you need is under/content/gallery/ you should definitely go for the new Page Bundles introduces in Hugo 0.32+

Currently adding descriptions for those images is not very straightforward. This is planned for the 0.33 release see relevant discussion on Github.

P.S. Sorry I misread your original post and thought that you wanted to have that gallery on your index.


#5

No worries! I’ll read up on Page Bundles and keep an eye out for 0.33. Thanks for the assistance. :slight_smile: