Is there a way to create a field that returns a full collection? I have a
Page
collection and a
Blog
collection in the CMS. Each page entry has a dropdown where I can choose a
Blog
post category and display the posts. I am trying to get the full
Blog
feed in the return from the
Page
query.
I know I can just query the feed in the component, but I was wondering if there is a way to do this in the first
Page
query.
Thanks!
You can use a relationship field, choose a blog post. Then when you query your page just make sure you set your
depth
to a higher number, maybe 2 or 3 but it will depend on your data structure on blogs
Hey thanks paul, I am acutally trying to get all the blog post feed. I was thinking that I could use the select field to choose the feed (eg. blog posts, case studies etc)
Ohhh I see, via the REST API, this is two separate queries right now
If you want to make things easier for yourself you could set up a custom REST endpoint
So you could set up a custom one to get a feed, then inside your handler you would do the logic of fetching the target Page's category and then do a find for blog feed
Got it. Thanks Paul!
Star
Discord
online
Get dedicated engineering support directly from the Payload team.