Sorry new to prismic so apologies if a very obvious question!!
I am trying to set up taxonomies for my project.
I have a couple of custom types called "blogAuthor" & "blogCategory"
I am trying to create a all blogs page that has cards that show the authors and the categories.
In order to do this I am trying to fetch all the blogs & use the fetchLinks param to get all the information associated with the linked custom type.
I am trying to test this out by just getting all the authors names using the format: "[linked-document-type].[field-on-linked-doc]"
const blogPosts = await client.getAllByType("blogpost", {
fetchLinks: "blogauthor.authorname",
});
However, when I console log out the result I see no changes and get:
[ {
id: 'ZiIz5hAAAMxFRPCc',
uid: 'test2',
url: '/blog/test2',
type: 'blogpost',
href: 'https://novabook.cdn.prismic.io/api/v2/documents/search?ref=ZiVCKxAAACYAUnEr&q=%5B%5B%3Ad+%3D+at%28document.id%2C+%22ZiIz5hAAAMxFRPCc%22%29+%5D%5D',
tags: [],
first_publication_date: '2024-04-19T09:06:04+0000',
last_publication_date: '2024-04-21T09:34:09+0000',
slugs: [],
linked_documents: [],
lang: 'en-gb',
alternate_languages: [],
data: {
categories: [Array],
authors: [Array],
blogtitle: 'Blog with two categories and two authors and a slightly longer title',
blogimage: [Object],
slices: [Array],
meta_description: null,
meta_image: {},
meta_title: null
}
},
{
id: 'ZiTyLhAAACGLUQuN',
uid: 'fourth-example',
url: '/blog/fourth-example',
type: 'blogpost',
href: 'https://novabook.cdn.prismic.io/api/v2/documents/search?ref=ZiVCKxAAACYAUnEr&q=%5B%5B%3Ad+%3D+at%28document.id%2C+%22ZiTyLhAAACGLUQuN%22%29+%5D%5D',
tags: [],
first_publication_date: '2024-04-21T11:02:12+0000',
last_publication_date: '2024-04-21T11:09:58+0000',
slugs: [],
linked_documents: [],
lang: 'en-gb',
alternate_languages: [],
data: {
categories: [Array],
authors: [Array],
blogtitle: 'Post about some tree',
blogimage: [Object],
slices: [Array],
meta_description: null,
meta_image: {},
meta_title: null
}
},
{
id: 'ZiI0WRAAABhGRPKv',
uid: 'third-test',
url: '/blog/third-test',
type: 'blogpost',
href: 'https://novabook.cdn.prismic.io/api/v2/documents/search?ref=ZiVCKxAAACYAUnEr&q=%5B%5B%3Ad+%3D+at%28document.id%2C+%22ZiI0WRAAABhGRPKv%22%29+%5D%5D',
tags: [],
first_publication_date: '2024-04-19T09:07:39+0000',
last_publication_date: '2024-04-21T09:34:30+0000',
slugs: [],
linked_documents: [],
lang: 'en-gb',
alternate_languages: [],
data: {
categories: [Array],
authors: [Array],
blogtitle: 'Another test blog about fundraising for your start up',
blogimage: [Object],
slices: [Array],
meta_description: null,
meta_image: {},
meta_title: null
}
}
]
What am I doing wrong??
Also, why are these custom docs not appearing in the linked_documents array for each of the blog posts they are added to?