WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Add rel="NoFollow" wp_tag_cloud? (16 posts)

  1. chris2006
    Member
    Posted 6 years ago #

    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

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    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.

  3. Kafkaesqui

    Posted 6 years ago #

    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.)

  4. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    Bah! You and your crazy filters! ;)

    (I didn't know wp_tag_cloud was filtered.)

  5. Kafkaesqui

    Posted 6 years ago #

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

  6. chris2006
    Member
    Posted 6 years ago #

    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,

  7. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    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.

  8. jonez
    Member
    Posted 6 years ago #

    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.

  9. ravetildon
    Member
    Posted 6 years ago #

    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..

  10. desimanifesto
    Member
    Posted 6 years ago #

    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

  11. xdesi
    Member
    Posted 6 years ago #

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

  12. Stefanie
    Member
    Posted 6 years ago #

    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.

  13. Sonance
    Member
    Posted 5 years ago #

    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.

  14. Sonance
    Member
    Posted 5 years ago #

    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).

  15. mystery777
    Member
    Posted 5 years ago #

    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.

  16. beggers
    Member
    Posted 5 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic