Hi everyone!
Issue
I have a page type with a "blog_page" name and want to create tags for them. I created a custom type "blog_tags". After this, I added a "group field" with a "tags" name to a "blog_page" and a "content relationship" with a "tag" name inside the "group field".
Now I want to make a request by uid of the "blog_tags" and retrieve all related "blog_page" pages but IDK how.
For reference I used this topic
This is a screenshot from the blog_page:
What steps have I taken?
I asked ChatGPT4o and it gave me this answer.
const blogPages = await client.getAllByType('blog_page', {
filter: prismic.filter.at('my.blog_page.tags.tag', tagUID),
fetchLinks: ['blog_page.title', 'blog_page.content'] // Adjust according to your blog_page custom type fields
});
For tagUid I am using this code:
const newTags = await client.getByType("blog_tags");
const tagUID = newTags.results[0].uid;
Problem:
I was trying to use this code but it is always returns empty results. How make it work?
Prismic version:
"@prismicio/client": "^7.3.1",