So for this section of code the posts.items will come back as undefined if you don't have a content_type of posts inside your Contentful account. You would probably want to wrap that in an if statement in production in case your content_type returns no items. But you will likely have multiple types you want to add here for example posts, pages, categories, etc. Anything that represents a page that you want to expose to google.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi!Great article, well done. Just a quick note, I think you're missing a piece as posts.items is flagged as not defined.
Maybe you want to add something like:
Hi Asher,
So for this section of code the
posts.items
will come back as undefined if you don't have acontent_type
of posts inside your Contentful account. You would probably want to wrap that in anif
statement in production in case yourcontent_type
returns no items. But you will likely have multiple types you want to add here for example posts, pages, categories, etc. Anything that represents a page that you want to expose to google.