Is there a way to query pages in the studio? I have a lot of pages that are more complex than cms templates, and I need to show recently created carousel
Can you elaborate a bit more what you mean by this?
for instance i have a lot of Recipe pages. I made a component called RecipeLayout. But I have a /recipes page too - where i need to show a grid of them sorted by date
Got it. You can use PLASMIC.fetchPages()
and render these how you’d like in your grid.
An example (of a different use case of the call):
export const getStaticPaths: GetStaticPaths = async () => {
const pages = await PLASMIC.fetchPages();
return {
paths: pages.map((page) => ({
params: { catchall: page.path.substring(1).split('/') }
})),
fallback: 'blocking'
};
};
cool! i’m looking for an example for filtering/sorting in the docs. Needing to sort them by date