Home » vue » Are items in Vuex with Nuxt being crawled?

Are items in Vuex with Nuxt being crawled?

Posted by: admin November 26, 2021 Leave a comment

Questions:

I’m planning on storing the majority of the texts for my blog in vuex for fast loading speed. Is this a good idea especially for SEO or should i create individual routes for all posts? I definitly do not know alot about SEO and I’m also new to vue/nuxt, before I’ve used mostly vanilla javascript.

Answers:

You can but its defenetly not recommended to do it like that.

Nuxt offers a good module for writing blogs https://nuxtjs.org/blog/creating-blog-with-nuxt-content

Works for static sites too. They get pre-rendered.

###

If you’re wondering about Google’s ability to see the content, I wouldn’t worry. I’ve tested a number of similar situations and even when data is pulled in via an external API, Google has been happy to wait a little while to see how the page renders and crawl the result.

However if you’re worried, just generate your component data using asyncData or fetch. Either will run before your template is rendered, so you can grab your data and make it available before page load.

export default {
  async asyncData({ store }) {
    return {
      blogData: store.state.blogs.find(blog => blog.id === 1)
    }
  }
}

Nuxt asyncData