By sedmi on
I would like to add nofollow to some internal links on my site like register and request new password.
How could I accomplish that? I followed direction found on: http://www.dandurick.com/blog/guide-drupal-seo and modified user.module, but with no success, the links didn't receive rel="nofollow". Any ideas?
Comments
A possible solution is
A possible solution is http://drupal.org/project/menu_attributes.
It is excellent solution for
It is excellent solution for links that are in menu, but can I add rel="nofollow" to register, request new password, syndicate links with it?
Not like that, there are
Not like that, there are several requests for it.
There is a nofollow module that got left behind, you could try to update it to Drupal 6.x.
To lower the importance of "service" pages;
-Move all service links to their own menu or block and make them nofollow (the block way means one less module). After that disable them in public menus.
-You could dump your db to sql, change the references there and reupload.(not always possible or wanted)
-don't create service links in content, always make reference to these links by pointing to the "service links block/menu"
-change your theme to add the nofollow to the service links as they are displayed (my preferred option).
This can mitigate the impact of having service links on all your pages.
Could you tell me more about
Could you tell me more about "-change your theme to add the nofollow to the service links as they are displayed (my preferred option)."
Should I modify page.tpl.php? And how? I don't have much experience with php.
You'll have to dig into php
You'll have to dig into php for this.
In my view there are roughly 2 options.
1. Brute Force.
In
node.tpl.phpscan and replace the<a href="linkyouwanttochange">....</a>with<a href="linkyouwanttochange" rel="nofollow">....</a>in the$linksstring with any of the php string replace functions (for example http://us3.php.net/str_replace or http://us3.php.net/manual/en/function.substr-replace.php). Of course first check in the source how the link is coded.This is not the preferred "drupal way", but it should not give major problems with updates.
2. Drupal Way.
Find the function that outputs the links you want to change and override the function in
template.phpof your theme.For example:
The "login or register to post comments" link is themed in the
comment.modulewith the following function:Add this function to your themes
template.phpas:You will have to override all the link theming functions that you want to contain the "nofollow" attribute.
You can also add the nofollow to the attribute array as
'rel' => t('nofollow').Hope this helps.
need advice on this topic
Hello Sedmi i would like to do the same things you wanted to do years back. I want to 'unfollow' some internal links just like register, my account and others so if you were able to do this and you can guide me through that would be great
Thanks
Thanks, I was finding this solution.
unneeded
actually, adding
rel="nofollow"to those links is completely unneeded since those paths are already inrobots.txtall search engines etc. will follow those instructions and thus never even visit those pages
if you add an alias to those pages, just add them to robots.txt yourself and search engines won't visit them.
see for an example: http://drupal.org/robots.txt
less == more
Page rank sculpting
Yes, spiders won't index them, but page rank will flow and I don't want that. I understand that there are a lot of people who think that it is not good thing to nofollow that kind of "unimportant" links, but I am one of those who favor nofollowing all links that aren't related to actual content. There are lot of places on internet where debates about that can be found, I think this thread is not place for debate whether it should be done, but for solution for those who do want to nofollow those links.
A Google search for register
A Google search for register at drupal http://www.google.com/search?hl=en&client=firefox-a&rls=org.mozilla%3Aen... shows that the drupal registration page is the highest ranked one, and that is what he wants to avoid (if not, that is what I would want to avoid).
Note that drupal.org/user/register is the first result AND is blocked in robots.txt. (maybe a refinement to robots.txt will help)
Also note that robots.txt and nofollow are mere "suggestions".
robots.txt and nofollow do related but separate things. To make a page less important, nofollow is the google acknowledged way (if that exists).