Hi everyone,
I really hope my question is not too simple but I am new to Nextjs and Prismic.
I search a lot for a solution but I really don't understand why I cannot get it to work.
I started my project with the Prismic NextJs starter "Information Site" and want to add a blog.
I created a Custom type for blog posts and a Custom type for authors.
In the blogposts Custom type I added a Content Relationship element which links to the author Custom type.
In the default page Custom type I added a Content Relationship element which links to the blogposts Custom type.
I added a [uid].js in pages/authors/ which generates a page for every author I created.
I added a [uid].js in pages/blog/ which generates a page for every blog posts I created. I have my page but I cannot get the author data.
I only get
{
"id": "Y2Ix7xQAACQAlbmL",
"type": "author",
"tags": [],
"lang": "en-us",
"slug": "eric",
"first_publication_date": "2022-11-02T09:01:38+0000",
"last_publication_date": "2022-11-02T09:01:38+0000",
"uid": "eric",
"link_type": "Document",
"isBroken": false
}
I don't get the name, position and picture data from the author Custom Type.
In the various pages of my website I want to have a slice which displays 3 blog posts selected by the content manager.
I created a slice to display the posts and in the Repeatable Zone added a Content Relationship element so the content manager can select the desired posts.
I canot get the blog post data nor the author data.
{
"variation": "default",
"version": "sktwi1xtmkfgx8626",
"items": [
{
"blogpost": {
"id": "Y2IyexQAALOqlbuw",
"type": "blogposts",
"tags": [],
"lang": "en-us",
"slug": "lorem-ipsum",
"first_publication_date": "2022-11-02T09:04:00+0000",
"last_publication_date": "2022-11-02T09:04:00+0000",
"uid": "lorem-ipsum",
"link_type": "Document",
"isBroken": false
}
},
{
"blogpost": {
"id": "Y2Iy0RQAACUAlb1w",
"type": "blogposts",
"tags": [],
"lang": "en-us",
"slug": "lorem-ipsum-2",
"first_publication_date": "2022-11-02T09:05:25+0000",
"last_publication_date": "2022-11-02T09:05:25+0000",
"uid": "lorem-ipsum-2",
"link_type": "Document",
"isBroken": false
}
},
{
"blogpost": {
"id": "Y2Iy-RQAALOqlb41",
"type": "blogposts",
"tags": [],
"lang": "en-us",
"slug": "lorem-ipsum-3",
"first_publication_date": "2022-11-02T09:06:04+0000",
"last_publication_date": "2022-11-02T09:06:04+0000",
"uid": "lorem-ipsum-3",
"link_type": "Document",
"isBroken": false
}
}
],
"primary": {
"title": [
{
"type": "heading1",
"text": "Blog posts",
"spans": []
}
],
"description": [
{
"type": "paragraph",
"text": "List of blog posts",
"spans": []
}
]
},
"id": "blog_posts$acc0df38-b9db-4130-9773-c3189d476958",
"slice_type": "blog_posts",
"slice_label": null
}
I created a public github repo with an example of my problem if you want to see:
And the vercel published website:
https://test-blogposts.vercel.app/
I hope my problem is well described.
Thank you for your help.