Inquiry on creating single related work

Im using nuxt with prismic. As reference to "Nuxt starter prismic blog" where the codes are

async asyncData ({ $prismic, store, params }) {
    const article = await $prismic.api.getByUID('article', params.uid)
    const { results: latestArticles } = await $prismic.api.query(
      $'document.type', 'article'),
        orderings: `[${[
          { field: 'my.article.publishDate', direction: 'desc' },
          { field: 'document.first_publication_date', direction: 'desc' }
        ].map(({ field, direction }) => `${field} ${direction}`).join(', ')}]`,
        pageSize: 3

My question is how do i set single related work and would not repeat on the other article instead need to show the next article that is available.
In elaboration, Let say there are list of 5 articles, then i click one of them it shows the articles content and below rather than having all latest article it need to show one by one per article without showing the previous ones in sequence. I hope its understandable.

thank you

Hello @sirotkind023!

You can use the getSingle() method. You need the previously retrieved IDs to get each one respectively. This method queries a singleton document from the Prismic repository for a specific Custom Type. type refers to the API ID of the Custom Type.

1 Like