I'm trying to link to the next post (if there is one) when on a single post page in my Next.js project. My code below is based on the solution here but I'm not able to get it working.
I query the next news post: const nextpost = await client.query(Prismic.Predicates.at('document.type', 'news'), { pageSize : 1 , after : ${doc.id}, orderings: '[my.post.date]'})
Then use that query for the link:
<Link as={linkResolver(nextpost)} href={hrefResolver(nextpost)}>
Next post
</Link>