Nuxt Seo and fetch method

652 Views Asked by At

I'm using fetch() method for retieve the data from an api, for seo purposes i'm retrieving the same info with asyncData() for use it in the head method.

My question is, there is no way to access the fetch method state inside the head to wait the retrieve of the data and just use one way to retrieve my info so i can remove the asyncdata call?

something like this:

head() {
  if (!this.$fetchState.pending) {
  return {
    title: `${this.post.data.attributes.title}`,
    meta: [
        {
          hid: "description",
          name: `${this.event.data.attributes.title} - Estudios Claw`,
          content: `${this.event.data.attributes.description}`,
        },
      ],
    };
  }
},

thanks

0

There are 0 best solutions below