Home » Web

Use noindex meta tag in WordPress to prevent search engine indexing categories, tags and archives

By: Zhiqiang Ma On: Jan 28, 2010 Views: 120 No Comment Print Email
Tags: , , ,

WordPress has the content duplication problem, which may confuse the search engine. Actually we only want the search engine to index the posts and pages instead of categories, tags or archives. And our site may get search engine penalty because of content duplication.

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. And add a index to the posts, pages, etc.

The method is simple. First find the head.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" />');
} else {
  _e('<meta name="robots" content="index,follow" />');
} ?>

Referrence:

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

Updated on 16 Mar. 2010.

Read more:

Digg del.icio.us Stumble Techorati Facebook Newsvine Reddit Twitter
Mixx LinkedIn Google Bookmark Yahoo Bookmark MySpace LiveJournal Blogger RSS feed
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading ... Loading ...

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.