Notes from the Martin Splitt’s JavaScript SEO Office Hours on April 29th 2020
JavaScript Redirects Work as an Alternative to Server Side Redirects
It’s OK to use a JavaScript redirect instead of an HTTP 301/302 redirect without any downsides for Google, but it will only work for crawlers which understand JavaScript.
Google’s Testing Tools Can’t Use a Cache and May Show Errors Which Don’t Impact Googlebot’s Rendering
Google’s testing tools don’t use caching in order to represent the latest content on your server, but they are using Google’s infrastructure to fetch content which may time out, and show as an ‘Other’ error. The real Googlebot indexing infrastructure is a lot more patient.
Use Tree Shaking and Code Splitting to Reduce JavaScript Bundling Size
You can reduce the size of JavaScript code bundles with Tree Shaking to identify and remove code which is not being used. Unbundling the JavaScript will increase the number of network requests and may slow things down. Code splitting can be used to split the bundles to optimise caching.
Google Search Isn’t Using a Chrome 41 User Agent
Google search hasn’t been using a Chrome 41 user agent since 2019, although it’s possible this might be from another Google service. If you see this in server logs you should check the IPs using reverse DNS lookup to verify if it’s genuine Googlebot activity.
Change URL Parameter Names to Force Google to Reconsider a Parameter’s Value
Google may incorrectly learn that some parameters are irrelevant, resulting in pages with those parameters being seen as duplicates, and canonicalised. It may take a very long time for Google to reconsider the parameters, so you can change the parameter name to cause Google to reprocess the URLs.
Avoid Dynamic Rendering Unless Necessary
Dynamic rendering is a workaround and adds complexity, so should only be used if it’s absolutely necessary.