WordPress.org

Ready to get started?Download WordPress

Forums

How to Add rel=nofollow to Blogroll Links? (29 posts)

  1. minusonebit
    Member
    Posted 6 years ago #

    How do I add "rel=nofollow" to specific links (but NOT all of them) in the blog roll to keep from passing page rank to the linked site? Whenever I try to type anything in the "rel" field on the link edit page (wp-admin/link.php?link_id=22&action=edit), some sort of form validation script backs out whatever I type in as soon as I type the first letter.

  2. minusonebit
    Member
    Posted 6 years ago #

    Not possible to do this?

  3. icesar
    Member
    Posted 6 years ago #

    Me three!

  4. obscure
    Member
    Posted 6 years ago #

    I don't know the answer I'm afraid but do have a question. Surely you only Blogroll people you respect and would like to do well. So why would you then stop them gaining any page rank from the link?

  5. minusonebit
    Member
    Posted 6 years ago #

    Obscure, because some of us use the blogroll function for things other than a blogroll. You rename the cats and now you have different sections for use in giving links to others in an industry, or maybe a sponsored link cat, etc... the reason I am asking is one section on one of my blogs is entitled "The Sh*tlist", and it lists people and companies you should stay far, far away from. Obviously, I do not want to be giving PR to people who I am encouraging others to stay away from.

  6. nims
    Member
    Posted 6 years ago #

    It would be really nice if someone could make a plugin that would enable webmasters to see and edit the anchor tag ("a href") in the blogroll/bookmarks area of wordpress. Or may be an option to add, edit extra attributes to the anchor tag.

  7. jmoz
    Member
    Posted 6 years ago #

    I made a simple plugin that adds nofollow to all blogroll links, download it here wordpress blogroll nofollow

  8. whooami
    Member
    Posted 6 years ago #

    for one.. the abilty to add nofollow to links in your blogroll already exists.

    It has for some time: Its right there where it says rel:

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

    whooami: You would think so... but no. I'm pretty sure that the rel field only allows the XFN stuffs.

  10. jmoz
    Member
    Posted 6 years ago #

    whooami you're wrong, you can't add nofollow links using the XFN stuff.

  11. whooami
    Member
    Posted 6 years ago #

    No, I am not wrong. You type nofollow into the box.

    Furthermore, JUST to make it more obvious in 2.5 they actually provided a link in the default blogroll that is already set that way -- seemingly because ppl couldnt figure out something so simple.

    1

    2

    3

  12. moshu
    Member
    Posted 6 years ago #

    In 2.3.3 it doesn't let you type anything in that filed. At least not on my install. The "rel" field is populated only by the values of XFN when clicking/checking any of the boxes/buttons below.

  13. whooami
    Member
    Posted 6 years ago #

    I JUST did this on a 2.3.3 install.

    Oddly enough, on another 2.3.3 install I can see where it will not allow you type. Thats a bug, not a feature.

  14. moshu
    Member
    Posted 6 years ago #

    Strange... whatever I'd try to type in that field - it is as if a ghost pushing the cursor back (like Backspace) and deleting my typing :)

  15. whooami
    Member
    Posted 6 years ago #

    I can see why that that would happen

    Inside edit-link.php

    <td width="80%"><input type="text" name="link_rel" id="link_rel" size="50" value="<?php echo $link->link_rel; ?>" /></td>

    But im looking at that 2.3.3 install with that exact code, and thats the one I just typed into :P

    I have a hard time believing I am the single WP user with this magnificent ability :)

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

    Just tested it myself. Doesn't work in either FF or IE. Typing into the rel field causes it to delete my characters as I type them. 2.3.3. Clearly some javascript preventing me from inputting text there.

  17. whooami
    Member
    Posted 6 years ago #

    I didnt doubt Moshu. I'm simply saying I JUST did it, complete with screenshots.

    aha! OK!! I know what it is :)

    I use noscript!!

    hence the difference.

    well anyway, its fixed in 2-1/2, isnt that days away?

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

    Yes, disabling javascript makes it work, but then also makes all the automatic XFN building code stop working.

    Looking closer at /wp-admin/js/xfn.js, this seems to be the desired behavior. Notice this:

    var aInputs = document.getElementsByTagName('input');
    for (var i = 0; i < aInputs.length; i++) {
     aInputs[i].onclick = aInputs[i].onkeyup = upit;
    }

    This sets every input field to run the upit() function on every keypress or click of those fields. upit() is earlier in the file, but basically it builds the link_rel field based on the XFN inputs.

    One solution would be to add a nofollow checkbox. This is actually very easy, given the javascript code. Just add this to edit-link-form.php, around line 113:

    <tr>
    <th scope="row"> <?php _e('following') ?> </th>
    <td>
    <label for="follow">
    <input class="valinp" type="checkbox" name="follow" value="nofollow" id="nofollow" <?php xfn_check('follow', 'nofollow'); ?> />
    <?php _e('nofollow') ?></label>
    </td>
    </tr>

    Voila. Checkbox produces nofollow code.

    I have not tested 2.5, but looking at the JS source doesn't show much difference to me. Looks like it would have the same issue. Still, the "fix" might be elsewhere.

  19. atanone
    Member
    Posted 5 years ago #

    Just wonder what happen to WP 2.5.1? I still have the same problem as with 2.3.3 and could not type anything to rel box. Looking at edit-link-form.php and don't know where to put the code above. If you can tell what is in line 113 and line 114, it would be great so I know exactly where to past these codes. Thanks.

  20. atanone
    Member
    Posted 5 years ago #

    I used wordpad and hate to count the line number. However, I put these lines of code just before these lines and got it works.

    <tr>
    <th scope="row"><?php _e('identity') ?></th>

    Thanks.

  21. Scraped Media
    Member
    Posted 5 years ago #

    Same here, i just added nofollow to the Rel box and you can't type anything in there it just deletes it.

    Why is it set like this, is it a bug?

  22. minusonebit
    Member
    Posted 5 years ago #

    Of course, disabling java script on the browser and then inputting it should allow you to get it done.

    I still say that's a bug and not a feature. Why would they put that java script in there? That's a stupid UE design. If you don't want users to edit the contents of a field, don't give them a field to edit. You don't give them a field and then put java script in place to back out their edits.

    Sure, now I know how to hack it by adding the check box code, but that still doesn't change the fact that's its a poor implementation.

    Can we get rid of this so-called "feature" of backing out edits to that box?

  23. deeplook
    Member
    Posted 5 years ago #

    I agree with minusonebit. It is really more a bug then a feature.
    And it would be very useful to have that option.

  24. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    I'll bring up the topic on trac.

    Done: http://trac.wordpress.org/ticket/7485

  25. deeplook
    Member
    Posted 5 years ago #

    Thanks Otto42.
    Much appreciated!

  26. eburgos
    Member
    Posted 5 years ago #

    Hi,

    I found a solution a few months ago and I posted it in
    http://www.eduardoburgos.com/2008/05/03/write-custom-rel-tags-for-your-links-in-wordpress-251/

    It's very similar to what Otto42 said.

    Cheers,

    Eduardo Burgos

  27. spstieng
    Member
    Posted 5 years ago #

    I've already got quite a few links. So going throught each and one adding "nofollow" is not an option.

    I could do it in the database, but again not the solution I'm looking for.

    I haven't tested this yet, but here is an thought:

    Why not just use javascript FindElementById and add the atribute 'rel' with the value 'nofollow' when the links are created?

  28. dr00t
    Member
    Posted 5 years ago #

    I know it's been a while, but I came across this plugin that appears to have a solution for everyone...and it doesn't require any hacks.

    http://wordpress.org/extend/plugins/nofollow-links/

    Merry Christmas.

  29. minusonebit
    Member
    Posted 5 years ago #

    Here is to hoping that someday (perhaps before I die), this makes it into a future release.

Topic Closed

This topic has been closed to new replies.

About this Topic