Static GitHub Issues

[2045] for SEO fetch data before render component and set meta details for social sharing links

prev: Component Files not watched in nested pages
next: How to add a global js file?

Hello,

i want to fetch the data before render the component.i tried many ways like asyncData, fetch, beforeMount etc.

i tried this way too..

  beforeRouteEnter(to, from, next) {
    next(vm => {
      vm.$store.dispatch('getItemsBySiteId', { id: to.params.id });
      vm.$store.dispatch('getSiteDetailById', { id: to.params.id });
    });
  },

but nothing works well... help me. i need when i share my urls on social networks, it can be happened to see description, title etc from fetched data.

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c1814">#c1814</a>)</em></sub></div>