Ryan S. Chiang

How to Prevent Google from Using "noscript" Content

How to Prevent Google from Using "noscript" Content

Updated

3 min read

I recently encountered an issue when developing the Featurable widget.

A customer noticed that the widget was causing some of their Google SERP results to use <noscript> tag content in their meta descriptions.

Noscript Content showing up in meta descriptions

To solve this issue, there are a few methods you can try:

Method 1. Use data-nosnippet

As detailed in the Google Search Central documentation, the data-nosnippet attribute requests that the Google bot excludes this content from appearing in search result snippets.

For my case with the Featurable widgets, adding data-nosnippet to the noscript tag was enough to solve the problem:

html<noscript data-nosnippet>Please enable Javascript to use this feature.</noscript>

However, the Google bot does not strictly follow meta tags or the nosnippet attributes. They are just suggestions, and Google will generate search results however it best decides.

Your first course of action should be trying the data-nosnippet tag and reevaluating after a few days to see whether the <noscript> content is still being picked up in meta descriptions.

But if the issue continues, you can try this second method:

Method 2. Use an image in your <noscript> tag

The other method for discouraging (and outright preventing) content from appearing in search result snippets is to use an image without alt text.

The purpose of a noscript tag is to inform the user that the feature or app won't work with Javascript disabled.

So we can replicate this by creating a JPEG that has whatever text you want to display.

html<noscript>
    <img src="/path/to/noscript-img.jpg" alt="" />
</noscript>

While specifying alt text is nearly always a best practice, in this case we don't want to.

While this method is more of a last resort option, it would work robustly for deterring Google from using noscript content in your search result snippets.

Summary

There's two main methods I'm aware of for discouraging and preventing Google from using noscript content in SERP results.

First, you can use the data-nosnippet tag on any elements you want to exclude from search result snippets. This appears to work well, but it's ultimately up to Google's discretion.

Second, you can replace any text within noscript with an image containing the same text. It is less likely that Google will extract text from an <img> tag without alt text.

Hope this short guide helps. Let me know if you know of any other methods for discouraging Google bot from indexing certain content.

Ryan Chiang

Meet the Author

Ryan Chiang

Hello, I'm Ryan. I build things and write about them. This is my blog of my learnings, tutorials, and whatever else I feel like writing about.
See what I'm building →.

If you want an alert when I write a new blog post (not often), you can subscribe below:

0

Comments

Leave a Comment

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

2024

2023

© 2024 Ryan Chiang