Listing content on homepage that *does not* generate a page for that item

I’m trying to figure out how I might go about building a homepage listing of content (all blog posts and another type I’ve called ‘insta’) without having hugo generate a page for each of the insta items.

The list will appear as the stream of content that makes up my blog but because the ‘insta’ items don’t have any content in addition to what appears in the summary I do not want an actual page for them.

I figured I could use headless: true in my frontmatter but this removes them from the listing too. I think I just need to build a better listing query but am unsure on the syntax I need to put together.

Currently the code that does the listing looks like

{{ $paginator := .Paginate (where .Data.Pages "Section" "in" (slice "post" "insta")) }}
{{ range $paginator.Pages }}
     {{ .Render "summary" }}
{{ end }}

Any advice?

You could use Data for this purpose.

If multilingual content is none of your concern, I’d use Data for this as mentioned above.

In case of multilingual content, I decided to stick to * files, rendered them on a list page and set up a redirection via Netlify that catches all /products/xxx URLs and takes them back to /products.

Not a clean solution really, but it does the job.

Data as in put content in the data folder?

Cause I’m making use of page resources to resize images and I don’t think that’ll function as Data?

This just came up with a quick search:

I haven’t tried it, but I’d assume that if your data contained a property to identifiy the matching image, the above could work in that case.

1 Like

That looks like it should work. I already use such a technique to handle randomised cover images.

I like that my image is contained with the markdown that makes up an insta post right now and it seems not massively ideal but if it works I’ll build that :slight_smile:

Wait, sorry to reply to myself but it occurs Data won’t work?

My index page contains a list of blogs and instas as shown in the snippet above. How do I pull insta’s from Data and posts from the normal Pages and have this list shown in chronological order?

I’m not sure you can do that :confused: