Support » Fixing WordPress » Add rel=”NoFollow” wp_tag_cloud?

  • Resolved chris2006

    (@chris2006)


    I’m currently displaying the Tag Cloud in my sidebar but would like to add the link attribute rel=”NoFollow” to the cloud tags – how is this possible?

    Thanks

Viewing 15 replies - 1 through 15 (of 15 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Short of editing the core code, it’s not. But I’m curious, why would you want your tag links to be nofollow? That doesn’t make much sense; nofollow is more intended for user or reader submitted links, really.

    If you just don’t want the tag pages indexed, you’d be better off creating a robots.txt file to make them disallowed specifically.

    Uh, a plugin for this is quite simple:

    Nofollow Tag Cloud plugin:
    Download plugin | View source

    Uncomment this line in the plugin:

    // add_filter('the_tags', 'szub_nofollow_tag');

    to affect links output by the_tags() template tag as well.

    (Note this just shows it can (easily) be done. Otto’s curiosity is still important to deal with.)

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Bah! You and your crazy filters! 😉

    (I didn’t know wp_tag_cloud was filtered.)

    (Been spending too much time browsing the source the past few days…)

    Thread Starter chris2006

    (@chris2006)

    Kafkaesqui: Thanks a lot for this – i’ve been looking for such a plugin for ages 🙂

    Otto42: Im working on my internal linking structure to help control the flow of pagerank on my site and put more emphasis on my main content pages. I wanted to nofollow the tag cloud links to remove some noise and stem any PR dilution on those lower quality pages.

    I like the tagging feature and it’s useful for my readers in enabling them to drill down further past a category into more specific terms, but from a search engine point of view it can open up a few problems – duplicate content etc,

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Okay, but nofollow won’t prevent those pages from being indexed and searchable. You’ll still have the duplicate content issue.

    Which is why I’d suggest robots.txt instead. Tell the search engine not to index those pages at all.

    Kafkaesqui: Thanks! Instead of a plugin, i just placed the juicy parts into my functions.php theme file.

    In my case, I want to nofollow all of my pages, since they’re just there for helping people, not search engines.

    BTW, this is one way to “sculpt your pagerank”, making all the other links on your page a little more noteworthy to the great and powerful Goog.

    What Otto said is probably good advice. First it’s probably advisable to nofollow the tag url’s first.

    In addition you should also create a robots.txt file making it so they don’t get indexed.

    If all those tag pages get indexed your entire blog will eventually go supplemental..

    desimanifesto

    (@desimanifesto)

    For all those wondering, here’s a different post that tells you how to modify and apply this plugin to add nofollow to your category lists, categories on posts and pages, etc.

    Very useful, and the only plugin that I could verify actually worked via the sourcecode.

    Forum: http://wordpress.org/support/topic/155906?replies=5#post-709137

    xdesi

    (@xdesi)

    Why don’t you just use a robots.txt file and dissalow /tag or whatever it is you are worried about?

    Is there a way to do this that doesn’t massively invalidate the page as this plugin does? It adds the rel=”nofollow” attribute fine, but the tag cloud links already have rel=”tag”, which causes every tag link to respond with an error when trying to validate, since there are two rel tags per link.

    Disallowing paths/files in robots.txt will prevent Google from indexing them, but it won’t prevent them from accruing page rank if Google has indexed pages that link to them.

    Adding a rel=”nofollow” to a link won’t prevent the page from being indexed, but it will prevent it from accruing page rank.

    How to add the rel=”nofollow” attribute to your tags.

    You’ll need to edit your category-template.php file. This is usually found here:

    \wp-includes\category-template.php

    Edit line 416 of the file so it reads:
    $rel = ( is_object($wp_rewrite) && $wp_rewrite->using_permalinks() ) ? ' rel="nofollow"' : '';

    Edit line 528 of the file so it reads:
    $term_links[] = '<a href="' . $link . '" rel="nofollow">' . $term->name . '</a>';

    Now all your tags have the rel=”nofollow” attribute.

    Why would you need to do this? Without nofollow, Google will pagerank your tag pages, regardless of what’s in your robots.txt or sitemap.xml file, and thus they’ll appear in Google search results (usually with a higher page rank than your actual blog posts).

    I would like a solution to the tags that appear in the homepage, underneath each post featured there.

    Kafkaesqui, your plugin is for the tags cloud but do you have any solution for post tags… these tags that you create under posts.

    The challenge is that I want to add a nofollow tag to them but ONLY in the homepage, and not in individual posts. I want to give them a chance to get indexed but at the same time I want to limit link juice from leaking out of the homepage.

    Sonance, how can I confirm that your modification is working? I checked the HTML of Tag Cloud and don’t see any nofollow attribute in the links. Thanks.

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Add rel=”NoFollow” wp_tag_cloud?’ is closed to new replies.