I'm fetching page content and blog posts, should I make two calls to Prismic?

Hi,

I need to get the page copy for my blog page (single type: blog_index) and a bunch of blog posts to display (repeatable type: blog_article). I'm building the blog in Next.js, which means I'm making these API calls in my getStaticProps function.

Right now I'm making two call to Prismic to get the blog_index page and then all the blog_article pages separately. I feel like two calls is unnecessary to Prismic and might slow down the load time of the page, but if I'm querying them together (e.g. Prismic.Predicates.at('document.type', ['blog_index', 'blog_article']) then blog_index becomes lost in a sea of results with documents (blog posts) and might not even show up on page one of results.

Is there a better way of separating the two, making sure I always get blog_index no matter what while still making only one call to Prismic or should I continue to make two separate calls to the Prismic API?

Hi Team,

Welcome to the community!

Like you said the best way is to do 2 queries as we do in our Next.js blog example homepage.

Thanks.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.