Tuesday, 24 November, 2020

SEO Quick Tip: How to Prevent Text Appearing in Search Results

Prevent Google from indexing sections of a web page using attributes in HTML comments.

There may be sections of text in Web pages you want to hide from search results when users search on certain words or phrases. These segments can be removed using HTML comments.

You can prevent this content from being indexed by using googleoff/googleon tags. By embedding googleon/googleoff tags with their flags in HTML documents [Google Documentation]

As an example, the following HTML would prevent the text inside the comments from being indexed:

<!--googleoff: index-->
<div class="someclass"> 
<p>Please don't show me in search results.</p>
</div>
<!--googleon: index-->

Read the full documentation on this feature on Google's search help pages.