Logic below explained: If user agent is a crawler/bot (e.g. google), then render the page with SSR.
serverMiddleware: [{
handler(req, res, next) {
let isBot = crawlersRegex.test(req.headers['user-agent'])
res.spa = !isBot
next()
}
}]
Using the fetch as google: https://www.google.com/webmasters/tools/googlebot-fetch
I get this strange result:
Obviously the content is empty. That was when loading indicator is disabled.
If loading indicator is enabled, then the loading indicator will be there:
Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)
User Agent. If I fake it in my chrome, I get correctly a SSR rendering.res.spa = false
in every request, google will render the results correctly. Therefore something is happening with the conditional rendering