Understanding JavaScript SEO

Javascript SEO

Remember in the olden days, when you had to argue with a sibling to make them get off the house phone so you could get online and chat with schoolfriends over MSN messenger? You’d sit for a good five minutes, listening to the soothing tones of the dial-up trying to form a connection, and then ‘Ask Jeeves’ something essential, like ‘When does it rain in Australia?’. Websites were basic, built only with HTML and CSS, and it took at least an hour to download an MP3 file on Napster.

Ahhh, simpler times.

As the internet evolved, so did websites and the way they were built. Now, JavaScript is the most widely used programming language used by developers across the globe, and hardly anyone has a landline telephone. Who’d have thought it?

But what actually is JavaScript and how does it relate to SEO?

Well, since you asked…

What is JavaScript?

JavaScript is a coding language used by developers to create websites and apps and to add interactive features.

JavaScript is as widespread online as sugar is in processed foods.

It is everywhere.

JavaScript SEO is the process of optimising websites and webpages that have been built with JavaScript to make them easier for Google to crawl and index.

JavaScript SEO won’t apply to many websites, most notably those that have not been heavily customised. It will apply to websites that use JavaScript to create whole pages, or where pages have undergone customisation in terms of what features existed on the page before, versus what features exist on the page now.

Fortunately, you don’t need to go and learn how to use JavaScript in order to be good at JavaScript SEO (breathe a big sigh of relief). Instead, you just need to get to grips with some of the best ways to optimise JavaScript pages.

We’ll get into that later.

Why Optimise JavaScript?

Speed is important.

Some of us (*cough* me *cough*) grew up hanging around next to a desktop computer the size of a small pony, waiting hours on end for TLC’s ‘No Scrubs’ to download so it could be transferred at a monumentally slow rate to an MP3 player.

Today, the average person won’t wait for more than two seconds for a web page to load. Since users have a need for speed, so does Google.

JavaScript has been known to slow down page loading times, which ultimately impacts user experience, which in turn can harm your ranking ability.

Optimizing JavaScript code will help your website run more smoothly, and ensure it gets crawled and indexed efficiently. In doing so, user experience is improved and you get extra points from search engines.

Optimise JavaScript for Crawling and Indexing

When a search engine bot works its way through the internet, it’s on a mission to crawl and index web pages.

This is how pages get stored and saved, ready for when a user makes a relevant search query. JavaScript requires a significant amount of effort from bots to be crawled and indexed, so when they come across JavaScript they might put it to one side and save it for later, instead opting to render the HTML on the page.

This can cause issues, so it’s really important to make sure your JavaScript-heavy content is crawlable and indexable.

Check for Errors

Use the URL Inspection Tool in Google Search Console to find out if Google is able to render your pages.

  1. Input your URL into the search at the top of the page and click enter.
  2. ‘Test Live URL’ on the right of the page.
  3. Once this has been completed, a ‘Live Test’ tab will appear.
  4. Select ‘View Tested Page’ and a sidebar will open where you can view the HTML, a screenshot, or more info.
  5. Click ‘More Info’, and you will be able to see any of the issues that arose in the test.

If this indicates that page sources couldn’t be loaded, you can remedy this by altering the code to allow JS.

Check for Indexing

You can easily check whether or not Google has indexed your page by using the Google search bar. Use the following format, replacing the domain and page URL with those of your site: ‘site:examplewebsite.com/selected URL’

If your page comes up as a result, this means Google has already indexed the page. If it doesn’t, then the page has not been indexed. You can see here, that the blog page on SEO Impact has been indexed.

Google Search Checking if Website Is Indexed

Having confirmed your URL has been indexed, you can use the same command to find out if the JavaScript portion of the page has been indexed. To do this, enter:

site:examplewebsite.com/selected URL “Javascript extract”

Your search might look like this:

site:seoimpact.co.uk/blog “newsletter sign up”

If your JavaScript has been indexed, you will see this in the search results. If it isn’t indexed, you will need to further analyse what’s going on with your site to find out why this has happened, and how you can fix it. This can be done using SEO tools.

JavaScript SEO Hacks

Optimising pages with JavaScript is much like optimising pages without JavaScript. You just need to know where to look.

Title Tags and Meta Descriptions

JavaScript frameworks tend to come in the form of templates, so title tags and meta descriptions are commonly set to default.

The problem here is when the tags are duplicated, with the same tag used for a whole group of pages.

You can overwrite these to create unique title tags and meta descriptions that are more relevant and search engine friendly.

Remove URL Hash

JavaScript has created its own purposes for the hash symbol, which differs to the way search engines understand it.

Google will usually ignore everything after a hash in a URL, so be sure to remove these from your URLs.

Good: “websiteexample.com/portfolio”

Bad: “websiteexample.com/#/portfolio”

In Closing

JavaScript is, quite literally, a different language, so don’t feel inadequate if trying to understand SEO for JavaScript has you feeling like you’re sitting in the back of Latin class counting down the minutes until lunch break.

JavaScript SEO is important when it comes to speed and therefore the ranking ability of websites.

You can optimise your JavaScript site yourself, or if you need an SEO pro to give you a helping hand, you can reach out to us.

Karli Edmondson-Matthews

Leave a Comment

Scroll to Top