Just wanted to offer this up because it was taking me for a little ride.
On this page:
There appears to be a typo (see screenshot at bottom) saying using
$prismic.predicates.at('document.type', 'page'),
$prismic.predicates.at('my.page.uid', 'about')
together will net you the page documents NOT where page.uid
is about
. At least for me this is not accurate and likely a typo where at()
on the second predicate should be not()
.
Also, if you're looking to only select for the page
at uid about
, then the first predicate would be redundant and actually prevents me from using a { fetchLinks }
object to include my content relationship.
What ended up working for me was
async asyncData({ $prismic, params, error }) {
const document = await $prismic.api.query(
$prismic.predicates.at('my.post.uid', params.uid),
{ fetchLinks: ['author.full_name', 'author.author_website'] }
)
if (document) {
return { post: document.results[0] }
} else {
error({ statusCode: 404, message: 'Page not found' })
}
},