InfoHeap
Tech
Navigation
  • Home
  • Tutorials
    • CSS tutorials & examples
    • CSS properties
    • Javascript cookbook
    • Linux/Unix Command Line
    • Mac
    • PHP
      • PHP functions online
      • PHP regex
    • WordPress
  • Online Tools
    • Text utilities
    • Online Lint Tools
search

robots.txt

  • Online robots.txt check
  • wildcard
  • disallow all
  • resubmit robots.txt to Google
  • Googlebot and js, css crawl
  • robot noindex, follow for wordpress
  • Allow Google adsense bot
  • parse robots.txt using python
 
  • Home
  • > Tutorials
  • > Web Development
  • > SEO
  • > robots.txt

Meta robot noindex, follow for wordpress tags and category pages

By admin | Last updated on Jan 26, 2016

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:

  1. For author and date archive pages it is best to use noindex, follow
  2. For tag and category pages it may be debatable. You can take one of the following approaches:
    1. Use index, follow for first page and noindex, follow for others
    2. Use index, follow for all tag and category pages
    3. 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.

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:
wordpress-seo-author-noindex-follow-option

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.

Suggested posts:

  1. Command line – run python webserver
  2. Svn – how to view older version of a file
  3. Svn – how to edit log message for a committed change
  4. Web fonts – beginner’s survival guide to web typography
  5. Svn log of all files in a directory
  6. How to setup wordpress custom query params with pretty url format
  7. jQuery – difference between html() and text()
  8. Mac brew (homebrew) – quick start guide
Share this article: share on facebook share on linkedin tweet this submit to reddit
Posted in Tutorials | Tagged robots.txt, SEO, Tutorials, Wordpress
  • Browse content
  • Article Topics
  • Article archives
  • Contact Us
Popular Topics: Android Development | AngularJS | Apache | AWS and EC2 | Bash shell scripting | Chrome developer tools | Company results | CSS | CSS cookbook | CSS properties | CSS Pseudo Classes | CSS selectors | CSS3 | CSS3 flexbox | Devops | Git | HTML | HTML5 | Java | Javascript | Javascript cookbook | Javascript DOM | jQuery | Kubernetes | Linux | Linux/Unix Command Line | Mac | Mac Command Line | Mysql | Networking | Node.js | Online Tools | PHP | PHP cookbook | PHP Regex | Python | Python array | Python cookbook | SEO | Site Performance | SSH | Ubuntu Linux | Web Development | Webmaster | Wordpress | Wordpress customization | Wordpress How To | Wordpress Mysql Queries | InfoHeap Money

Copyright © 2025 InfoHeap.

Powered by WordPress