JavaScript Rendering & SEO
Search engines treat JavaScript content on a website differently from typical HTML content and will render it separately. As the use of JavaScript on the web increases due to the number of features it makes possible, it is important to understand how search engines view this content and optimize for this. Check out our “Hamburger Analogy” an introduction to client-side vs. server-side JavaScript rendering.
Our SEO Office Hours notes and video clips compiled here cover JavaScript-related SEO best practices from Google, along with notes on the latest advancements to their rendering engine.
URLs in JavaScript May Be Crawled
JavaScript variables which look like URLs may be crawled, which can generate server errors. But you can ignore them, or block with robots.txt
HTML Crawling Faster Than JavaScript for Page Discovery
JavaScript processing takes longer than pure HTML crawling, so isn’t suitable for fast discovery of pages. John says ‘it takes another cycle or two longer to process’.
CSS and JS Crawling Is Important for Mobile Compatability
Allowing your CSS and JavaScript files to be crawlable does affect desktop pages, but is more important for mobile pages as they need to test for mobile compatibility.
Disallowed CSS/JS Is a Problem If It Prevents Rendering
Disallowed CSS and JS is only an issue if it actually prevents Google from finding visible content, or rendering pages correctly. Other JS files don’t matter so much. There aren’t any penalties or anything like that.
Google Needs to Be Able to Crawl CSS and JavaScript
Don’t block your CSS and JavaScript from being crawled.