Hi there,
In a blog post page, I am trying to query related blog posts based on a boolean (isFest) in my post content type. I wrote the following code, but it won't work, I have this error message instead 'SyntaxError: Unexpected token E in JSON at position 0'.
const relatedPosts = await Client.query( [Prismic.Predicates.at('my.blog_post.data.isFest', true)] )
Thanks for your help !
Phil
(Phil Snow)
May 24, 2021, 4:49pm
3
Hi Stephanie,
Welcome to the community!
I think the issue might be that your query should look like this:
const relatedPosts = await Client.query(Prismic.Predicates.at('my.blog_post.isFest', true))
The field must be in the top level of the document and not in a Slice.
Thanks.
Hi Phil,
Thanks a lot ! Indeed it works now like a charm ! Loving Prismic so far ! This is my first go with it and definitly worth learning
Thanks again,
Stephanie
1 Like
system
(system)
closed as resolved, flag & select 'Something Else' to reopen.
May 26, 2021, 5:58am
5
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.