Building a cross-content-type listing page

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?

Hey @WJoseph50 - thanks for posting in the Community!
I’d like to tag in some experts here to see if they have any ideas on how we might be able to achieve this! @DanielPicklo, @ChrisMagtoto, and @FabianRichter - any thoughts on this for @WJoseph50?
Shane, Community Manager

Thanks for trying to help me find an answer @STierney . Has anyone got any ideas?..

Yes, the only way you would be able to do this is by using the Site Pages and Landing Pages APIs to get all pages as HubL and even GraphQL are limited in the amount of data that can be pulled.