Hello,

Drupal adds rel=nofollow for external links, and "Follow" module should follow this tradition :) Currently, links do not have rel="nofollow" added.

Comments

AlexisWilke’s picture

That's a strange idea!? Why wouldn't you want to send juice to your own personal accounts????

giorgio79’s picture

I have lot of users, and some of them are spammers... With spam accounts on facebook and friends.

Also, those are all external 3rd party sites, and I couldn't care less about them. They may get hacked, go out of business etc.

myname.com, now that I consider my own account, but again this is not about a site where one user puts out his links, but where thousands do so...

AlexisWilke’s picture

Nevermind! That makes total sense. 8-)

eule’s picture

i agree ..and prefer a option (for any user) to set the links nofollow. pls help with code, i look into the follow.module code but can´t find something to add a nofollow rel..any help?

btw i´m in 7.x-2.x-dev

in my opinion this recomend external link module is not working and the site is still broken when i use it. issue with this is here http://drupal.org/node/1724302

defconjuan’s picture

Until it's added, you can do the following:

--- a/sites/all/modules/follow/follow.module
+++ b/sites/all/modules/follow/follow.module
@@ -332,6 +332,7 @@ function theme_follow_link($variables) {
   $attributes = array(\r
     'class' => $classes,\r
     'title' => follow_link_title($link->uid) .' '. $title,\r
+    'rel' => 'nofollow',\r
   );\r
   $link->options['attributes'] = $attributes;\r
   return l($title, $link->path, $link->options) . "\n";\r
defconjuan’s picture

Or, better than #5: The following solution DOES NOT hack the follow module. We basically use a theme function override to override the functionality of follow's theme_follow_link function.

Say you're using a theme called facepalm.

Step 1 (and only)

Add the following code to the bottom of facepalm's template.php file:

function facepalm_follow_link($variables) {
  $link = $variables['link'];
  $title = $variables['title'];
  $classes = array();
  $classes[] = 'follow-link';
  $classes[] = "follow-link-{$link->name}";
  $classes[] = $link->uid ? 'follow-link-user' : 'follow-link-site';
  $attributes = array(
    'class' => $classes,
    'title' => follow_link_title($link->uid) .' '. $title,
    /* The following line is the only line added/different from the stock function defined with 'follow' */
    'rel' => 'nofollow',
  );
  $link->options['attributes'] = $attributes;
  return l($title, $link->path, $link->options) . "\n";
}

If you want to also add the ability to open the follow links in a new window without adding the external module, you can combine this solution with the following: http://drupal.org/node/1271874#comment-7067010

floydm’s picture

The attached patch was made against the 7.x-1.x branch in git. It adds an option to the admin screen that lets you add the rel="nofollow" attribute to all user follow links. It does not add rel="nofollow" to the sitewide follow links.

floydm’s picture

Status: Active » Needs review
floydm’s picture

elachlan’s picture

Should this be re-rolled for 7.x-2.x-dev?

socialnicheguru’s picture

Issue summary: View changes

I get this error when applied to 7.2x
Notice: Undefined variable: values in follow_contextual_links_view_alter() (line 468 of follow

webankit’s picture

StatusFileSize
new10.83 KB

I propose a more general solution to allow extra arguments to allow rel and target

webankit’s picture

StatusFileSize
new3.89 KB

Revised Patch.

astonvictor’s picture

Status: Needs review » Closed (outdated)

I'm closing it because the issue was created a long time ago without any further steps.

if you still need it then raise a new one.
thanks