talking about sub-pages: If you need to combine page-wide data (eg meta description, featured image) with repeating content like posts - what's your approach?
a) collection + global: Use a collection for the repeating content (posts) and a global for the page-wide content
b) global + array field: Use a global that mimics the page structure including an array for the repeating content
a) probably offers better performance in the admin UI, offers the list view which is more suitable for large arrays of data
b) offers a clearer UI for the customer (all page data is found in one place, furthermore in the order how it's shown in the frontend)
Maybe I am misunderstanding your question - but what we normally do is create a group of meta fields and add them to a collection, and on every collection the meta data is unique so it needs to be filled out on a per document basis.
We have built a plugin for managing meta data as well and you can read more about it here.
Let me know if I am missing something!
Thank you for your reply.
[...] create a group of meta fields and add them to a collection [...] on every collection the meta data is unique so it needs to be filled out on a per document basis.
Well, I don't want one document to be rendered as one page.
I want all - let's say - blog posts on one page, all publications on one page,...
For these pages I need meta data, a featured image, headings.
Before I had it organized using a collection (containg posts) plus a global (containg the page wide data).
Now I organize it putting everything in a global using an array for the blog posts.
It works fine but I was wondering how other people do it and what the advantages and disadvantages of either approach are.
Couldn't you make a pages collection, create a page, select (relationship field) the docs from the other collection, then set metadata on the page?
We normally create pages with
blocks and make a block for what you are describing. You could create a block that lets you pick specific docs from other collections (using a relationship field). You could also adjust how your block works and allow for users to check a check box i.e. "latest", and then you could use a before read to populate the field dynamically.
This is the approach I would recommend, storing meta inside a global feels odd, personally.
Thank you Jarrod, you've corrected my way of using Payload at the right time.
I've found another disadvantage of b):