We've retired the forum in favor of GitHub Discussions.

New conversations can be started on GitHub. Existing conversations will remain for a while longer.

Head over to GitHub →

How to add data to all entries in a collection?

Conor Hawkins November 23, 2020 by Conor Hawkins

Sorry in advance for the not-so-descriptive title. I thought about it for ages and couldn't come up with anything better.

Anyway, here's what I'm struggling with:

I have a collection called pages. My pages blueprint has a field called background_colour, which I use to control the background colour of the pages on the frontend.

I also have a collection called products. Each entry in this collection is a product (obviously). I can access each product at products/{slug} and change the template. So thats all going well.

Now I want to be able to go into the control panel, and change the background_colour of the product show page (products/{slug}), but I can't seem to figure out how.

I figured it might involve mounting the products collection onto an entry in the pages collection called something like 'Product Show', but I haven't managed to crack it yet.

Adding a background_colour field to my products entries would work, but it would mean that each entry would have its own colour. If I wanted to change the colour of the show page, I would have to change each of the entries. I want a way to add data that will affect all product show pages.

I hope I made my question clear. It seems like such a simple thing but I'm a bit stuck. Any tips would be greatly appreciated :)

Thanks for your help

>>>>>>> Unanswered <<<<<<<
3 Replies