I am building a blog based off of this project here from Contentful using NuxtJS https://github.com/contentful/blog-in-5-minutes
Here is mine: https://github.com/KyleTryon/VidFireBlog
I am currently experiencing two issues so far with retrieving data as they do in the example.
https://github.com/contentful/blog-in-5-minutes/blob/master/pages/blog/_slug.vue
In the example you can see the headerImage
contains .fields.url
When I return in image on my project in the same way, there are no fields.
{ sys: { type: 'Link', linkType: 'Asset', id: '1YADPXXX-' } }
https://github.com/KyleTryon/VidFireBlog/blob/master/pages/blog/_slug.vue
This is again based directly off of the example linked above.
return client.getEntries({
'content_type': env.CTF_BLOG_POST_TYPE_ID,
'fields.slug': params.slug
})
This should only return entries of the type blog post. I have a v-for rendering each post. at the moment I only have two. I see a third item on my page and after further inspection, i see that the third item is from the API also returning my "author" asset of a different type. This is also the only other published content I have. So it seems just all content is showing and the filter is ignored.
for the first issue, could it be your asset was not published?
for the second, you actually have a typo in your code:
https://github.com/KyleTryon/VidFireBlog/blob/master/pages/blog/index.vue#L63
CTF_BLOG_TYPE_ID
should be CTF_BLOG_POST_TYPE_ID
All the best, Benedikt