Free Account
Advertisement
  1. SEJ
  2.  » 
  3. SEO

Google: No Need to Worry About Using JavaScript

Google says, from an SEO perspective, there’s no need to worry about using JavaScript when building websites.

Google: No Need to Worry About Using JavaScript

Google says there’s no need to worry about JavaScript when it comes to search, as there’s nothing fundamentally different about it compared to static content.

This is discussed in the latest episode of the Search Off the Record podcast, which features Google’s Martin Splitt, John Mueller, Gary Illyes, and Daniel Waisberg.

Mueller brings up the topic of building a website using a static site generator, which leads to the realization that he and Splitt both use the same tool called Hugo.

For simplicity Hugo uses the Markdown language to generate pages, but that comes with the limitation of not being able to use HTML for things like nofollow tags and redirects.

Advertisement
Continue Reading Below

Mueller is building a personal site that requires redirects, and the only way he can implement them in Hugo is with JavaScript.

He then asks Splitt, Google’s resident JavaScript expert, whether there’s any reason to be worried about using JS.

There’s no reason to be worried, Splitt says, and he explains why:

“No, you don’t have to be worried about that…

A question that I often also get with JavaScript is if we treat JavaScript content differently. We do have annotations for content– what we think is the centerpiece of an article or what we think is content on the side and stuff.

But as far as I know, and as far as I can see, we crawl a page and then put the content into the document in our index, and then we render the page, and then we complete the content from the DOM.

That’s it. There’s nothing that is fundamentally different between JavaScript generated content and static content, except for when there’s edge cases, and we can’t see content that is generated by JavaScript.”

Advertisement
Continue Reading Below

Splitt references “edge cases” without going into detail about what those are. Though Google has discussed in the past how sites can run into SEO problems when using JavaScript.

The main thing to avoid is using JavaScript in a way that forces users to interact with an element on the page in order to display content.

A basic example of this would be hiding content behind a button that users have to click in order for the content to render.

That’s a problem, as far as SEO is concerned, because Googlebot doesn’t interact with anything when it crawls webpages.

If content is hidden behind a JavaScript element that users have to click or tap on, Google simply won’t see it. Therefore the content can’t be used to understand the page and rank it in search.

Site owners who intend to use JavaScript in this way as a design choice should make sure the hidden content isn’t crucial to understanding what the page is about.

If you’re not sure whether JavaScript is preventing Google from seeing content on your pages there’s an easy way to find out.

Use the Fetch as Google tool in Search Console to get an idea of what Googlebot is able to see when it crawls your site.

Advertisement
Continue Reading Below

If the Fetch as Google tool is able to render all critical content, then you’re in the clear. No need to worry, as Splitt says.

This is just one of the many topics discussed in the podcast. Listen to the full episode below.

CategoryNewsSEO
ADVERTISEMENT

Subscribe to SEJ

Get our daily newsletter from SEJ's Founder Loren Baker about the latest news in the industry!

Topic(s) of Interest*
By clicking the "SUBSCRIBE" button, I agree and accept the privacy policy of Search Engine Journal.
Ebook

Matt Southern

Lead News Writer at Search Engine Journal

Matt Southern has been the lead news writer at Search Engine Journal since 2013. With a degree in communications, Matt ... [Read full bio]

ADVERTISEMENT
Advertisement
Read the Next Article
Read the Next