In order to have a completely separate Nuxt page for search versus our homepage, we implemented a redirect if the query string parameter q
is present. We use vue-router’s beforeRouteEnter
hook to implement the redirect:
beforeRouteEnter (to, from, next) {
if (typeof to.query.q !== 'undefined') {
next({ name: 'domain', query: to.query, replace: true })
return
}
next()
}
Everything works great, except, on the server, asyncData
isn’t called by the domain
route. It otherwise loads and renders correctly, sans asyncData
.