Customize Your Robots Meta Tags in Thesis

This is a followup response to Everfluxx, who wrote a post about the robots meta tags that Thesis inserts into archive pages.

add noindex to archive pages

Everfluxx discovered that when you opt to add the noindex attribute to your pages’ robots meta tags, Thesis automatically assumes you meant noindex, nofollow. However, the nofollow attribute can cause a loss of site-wide PageRank, so many Thesis users will probably need a way to remove it.custom meta robots with thesis

For a complete explanation, check out this must-read post from Everfluxx:
Using Thesis? Then beware of the “hidden” nofollow on archive pages!

In his post, Everfluxx describes the problem and proposes a solution. His solution is quick and easy, but it requires editing Thesis core files, which makes some bloggers nervous (since they would have to redo that code edit every time a new version of Thesis is released). In his closing paragraph, Everfluxx writes:

A final word to fellow Thesis developers/hackers: if you can think of a Better Way To Do It that does not require editing the theme files (e.g., via WP hooks, I dunno), please drop it in the comments. Thanks

I was in the mood for some php coding, so I set to work and made it happen. But…it was just too beautiful to leave as a comment…so I kept it all to myself! (Sorry, Everfluxx! If it’s any consolation, I’ve used hot pink throughout this post…in your honor! =P)

How to Customize Your Robots Meta Tags in Thesis

  1. UN-check the boxes under Add Noindex to Archive Pages in the Thesis Optionsmenu. (The code below will add the robots meta tag for you, so if you leave the Thesis options checked…you’ll end up with 2 robots meta tags on each page.)
  2. Copy the code below and paste it into your custom_functions.php file.
  3. Edit the robots meta tag that corresponds with each page type to suit your specific needs. I have included a variety of page types already, but feel free to delete the ones you don’t need. For more-advanced customizations, reference the WordPress conditional tags.
  4. Promote this post for me by clicking the social media widgets below.
// Define your motherfuckin' meta robots tags
function my_mofo_meta_robo() {
if (is_home())
$mofo_robo = "\n"; // HOME PAGE
elseif (is_single())
$mofo_robo = "\n"; // SINGLE BLOG POSTS
elseif (is_page())
$mofo_robo = "\n"; // PAGES
elseif (is_category())
$mofo_robo = "\n"; // CATEGORY ARCHIVES
elseif (is_tag())
$mofo_robo = "\n"; // TAG ARCHIVES
elseif (is_author())
$mofo_robo = "\n"; // AUTHOR ARCHIVES
elseif (is_date())
$mofo_robo = "\n"; // DATE ARCHIVES
elseif (is_search())
$mofo_robo = "\n"; // SEARCH PAGES
elseif (is_404())
$mofo_robo = "\n"; // 404 ERROR PAGE

echo $mofo_robo;

// Add your motherfuckin' meta robots tag to thesectionadd_action('wp_head', 'my_mofo_meta_robo');

Recent Content

link to SparkToro Review

SparkToro Review

Doing effective customer research is a challenging task that requires a lot of legwork. In a typical customer research process, marketers struggle to find out where their customers hang out, what they like, who they follow, what publications they read, what podcasts they listen to, and a lot more. This shows how understanding your customer […]
link to Combin Review: How to find and maintain the interest of your target audience on Instagram

Combin Review: How to find and maintain the interest of your target audience on Instagram

This post was sponsored by Combin. Instagram has enjoyed massive growth since its inception in 2010. With over 1 billion active users, Instagram is one of the most effective social media platforms for marketing brands. It has a highly active community that makes it a potential goldmine for businesses looking to increase customer engagement. Despite the […]