In case you want search engines to either not index or not follow links on a page, you can use robot meta tag. The default behavior is to index and follow. So no meta tag is needed in most cases as default is good enough.
Overview of robot meta tag
Here is how a robot meta tag looks like:
<meta name="robots" content="noindex,follow"/>
This means that don’t index current page but follow the links. You typically use this for pages like date archives, etc.
Robot meta in wordpress
For many browse pages in wordpress like author, tag, categories, you may not want a search engine to index them. But you would still want search engines to follow links to discover article pages. Here are few things you may want to consider:
- For author and date archive pages it is best to use
noindex, follow
- For tag and category pages it may be debatable. You can take one of the following approaches:
- Use
index, follow
for first page andnoindex, follow
for others - Use
index, follow
for all tag and category pages - Use
noindex, follow
for all tag and category pages
I’m more inclined for first of these three approaches. But I feel its worth considering 2nd approach as well. The default setting in WordPress SEO plugin uses 2nd approach.
- Use
Robot meta tag using wordpress seo plugin
In case you are using Wordpress seo plugin, setting Robot meta tag for author, date, tag, category pages is pretty easy. But you can’t customize different meta tag for first page and subsequent pages. Here is how setting noindex, follow
looks like using WordPress seo plugin for author archives pages:
Robot meta tag using custom plugin
In case you decide to use index, follow for tag and category browse first page, you can write a custom wordpress plugin. In case you are using wordpress seo plugin, you can the following custom code:
function my_wpseo_head () { if (is_category() || is_tag()) { $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; if ($paged > 1) { echo '<meta name="robots" content="noindex,follow"/>' . "\n"; } else { echo '<meta name="robots" content="index,follow"/>' . "\n"; } } } add_action( 'wpseo_head', 'my_wpseo_head');
Note that we are using wordpress seo plugin so that we can use the action hook wpseo_head. In case you are not using that plugin, you can use wp_head action hook.