I'm learning Sanity io CMS and GROQ. I've build a simple blog using one the Sanity predefined blog schema. I've managed to show posts, a single post and the author page, showing name, image and bio.
What I would like to do is to show a list of the blog posts belonging to the author in his page. In the posts schema there is a reference to the author:
{
name: 'author',
title: 'Author',
type: 'reference',
to: {type: 'author'},
},
I've tried to add an array reference to post
in the Author schema, but the result is that in the CMS I need to manually add posts to the author. While, I'd like to query the author and return the posts belonging to the author since there's a reference to it in the posts schema , but cannot find how to do it. Is it possibly more a GROQ query than a schema problem, or both?