Use noindex Meta Tag in WordPress to Prevent Search Engine Indexing Categories, Tags and Archives

WordPress has the content duplication problem which may confuse search engines. Duplicate content won’t hurt you, unless it is spammy or keyword stuffing, as said by Matt Cutts, and Google may just ignore the duplicate content. However, instead of letting the search engines decide which pages of the duplicate ones are important, we may only want the search engine to index the posts and pages instead of categories, tags or archives.

A noindex meta tag will prevent search engine such as google from indexing the page. Google’s rule about noindex tag is like this [1]:

“When we see a noindex meta tag on a page, Google will completely drop the page from our search results, even if other pages link to it. If the content is currently in our index, we will remove it after the next time we crawl it. The meta tag allows you to control access on a page-by-page basis, which is useful if you don’t have root access to your server. (You’ll need to be able to edit the source HTML of your page.)”

We can add noindex tag to the head of archives, categories, tags and search results in WordPress.

The method is simple. First find the header.php file in the theme directory. Then insert these codes into the area between <head> and </head>:

<?php
// Do not index author, date archive, category, tag and search result
if( is_author() | is_date() | is_search() | is_category() | is_tag() ) {
  _e('<meta name="robots" content="noindex,follow" />');
}
?>

If you would like search engines to index some pages, such as the categories, you may delete the relevant is_… functions such as is_category().

Referrence:

[1] http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=156412

Eric Zhiqiang Ma

Eric is interested in building high-performance and scalable distributed systems and related technologies. The views or opinions expressed here are solely Eric's own and do not necessarily represent those of any third parties.

5 comments:

  1. That’s really a very simple solution to No index tags and categories. But if you are using Yoast plugin you may configure it to no index the tags and categories.

Leave a Reply

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