Hey folks,
I need to build a new page template in my theme that lists out content, with filters to allow the user to narrow down their query. The items in the listing need to be a mix of blog posts (from multiple blog groups) and pages.
I can easily create and add a module to the blog post template(s) and page template(s) that allows CMS users to define the taxonomies for individual pieces of content.
However, when it comes to templating the listing itself I’ve hit an issue. For blog posts, I can use blog_recent_posts() to retrieve (max 200) blog posts from each blog group and then filter that down to posts that match the current applied filters. But with pages, I’m a bit stumped. It looks like the only way to retrieve pages in this way would be to use content_by_ids(), which takes an array of page IDs. But that would involve the CMS editor opting in pages; where as I ideally want to start with a stack of all pages and cut it down to size.
It looks like even if I were to write my query in a GraphQL query and hand it off to the Hubl template, I still can’t see a way to traverse pages in any global way.
Any pointers would be greatly received! Yes I know that is handing off a lot of logic into the Hubl template, which may not be the intended use case here. Would the only way be to interact with the API?