Hello, i was wondering how i fetch the data of a content relationship when its in a group. I have a homepage and with conten relationship in a group i show some of the blogs. I want to fetch the title for examle of the blog. I now have that it shows some data, but not everything.
Hi @justin.berghahn ,
Welcome to the community!
To get data from linked documents, you'll have to use GraphQuery, our query option where you define the field you want:
Let me know if you have any questions.
Thanks.
Yes, but you will need to to get the linked documents info. GraphQuery is not GraphQL. GraphQuery uses a GraphQL-like syntax. However, GraphQuery doesn’t include some GraphQL features such as named queries or introspection.
You might query like this then:
import * as prismic from "@prismicio/client"
const client = prismic.createClient("example-prismic-repo")
async function init() {
const response = await client.getAllByType("blog", {
graphQuery: `{
blog {
author_link {
...on author {
author_name
}
}
}
}`
})
return response
}
init()
Okay thank you, i'll check it now!
1 Like