How to Make JavaScript Indexable by Google

JavaScript-logo

We all know how important is to make your content indexable by search engines. However, we also know that design of a website is as important as its content and fancy design usually requires lots of JavaScript. As search engines have difficulties with indexation of JavaScript, it’s possible that search engines won’t be able to see every piece of your content if you use lots of JavaScript.

Is there any workaround?

Usage of <noscript> tag is a common practice in web development. As <noscript> tag is rendered only on browsers with JavaScript disabled, developers use it to provide alternate content for users with JavaScript disabled. However, I was wondering if content of <noscript> tag is indexed by Google, so I decided to do a test. As my test showed that Google index content within <noscript> tags and another test showed that Bing and Yahoo! index <noscript> tag, I came up with a idea to use <noscript> tag to make JavaScript based content indexable.

Important note

Due to abusement of <noscript> tags by spammers, Google won’t give any value to links contained in <noscript> tag. So, please make sure that important content of your website is not JavaScript based. Also keep in mind that if you need to use <noscript> tags extensively, you’re probably doing something wrong.

How to use <noscript> tag

I believe readers of this blog are already familiar with some web development basics, so I’ll give you one simple example.

<script type="text/javascript">
document.write("Your content")
</script>

<noscript>Your content</noscript>

You should add your content enclosed with <noscript> tags right after your JavaScript code. This example is very simple, but generally, within <noscript> tag you should use content that is generated by JavaScript code.

If you do something like that, both users and Google will see your content.

Why you should or shouldn’t use <noscript> tags

Obviously, one of the reasons to use <noscript> tag is to make JavaScript based content indexable. However, this is not the only benefit you’ll get when using it. <noscript> tag will also provide a better user experience for users without JavaScript (believe me or not, there are users that still search online with JavaScript disabled).

There are some drawbacks too. Implementing both JavaScript based content and <noscript> alternatives requires more time, effort and money for development.

Another problem is that adding additional tags to a page, results in an increase of a page size. Increase of page size will negatively affect its speed and if we consider that website speed is a ranking factor, we realize that we have to be careful. Luckily, size increase shouldn’t be big enough to noticeably affect speed.

Please don’t spam!

Spammers often use <noscript> tag because huge majority of users won’t see its content, but Google will. However, Google will fight against spam. If they catch you, you’ll get penalized. Please use this trick just to make content that is visible to users also visible to Google, not to fool Google to rank you higher or any other spammy action.

Note: The opinions expressed in this article are the views of the author, and not necessarily the views of Caphyon, its staff, or its partners.

Author: Bojan Jovanovic

Hi! My name is Bojan Jovanovic. Currently, I work on website development, web application development and write on my SEO and WEB development blog. Beside WEB, I like all kinds of motorsports and hockey. You can get in touch with me on Twitter and Google+.

2 thoughts on “How to Make JavaScript Indexable by Google”

Leave a Reply

Your email address will not be published. Required fields are marked *