Static GitHub Issues

[2076] Meta tags based on asyncData

prev: Starting Nuxt in PM2 Cluster Mode
next: Meta tags based on asyncData server rendered

Hi there, I am trying to set one of the page's meta tags based on asyncData (need to fetch public information about the page)

asyncData ({req, isServer}) { if (isServer) { return axios.get(url).then(res => { return { title: res.data } } } }, head () { return { title: this.title || 'default title' } }

The tags get rendered correctly but only AFTER the page has been loaded, basically the server rendering part doesn't wait for the asyncData to finish before rendering the page. When trying to curl the source of the page, the HTML returned has the default title. Any ideas ?

<!--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/c1842">#c1842</a>)</em></sub></div>