• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

How to add rel="nofollow" to link [Deleted]

#1
hkda_vietnam submitted a new resource:

How to add rel="nofollow" to link (version 1.0) - rel nofollow, link nofollow

To avoid spam link in your XenForo you can add rel="nofollow" to link.

Open file /library/XenForo/Helper/String.php and find:
Code:
  public static function getLinkClassTarget($url)
    {
        $target = '_blank';
        $class = 'externalLink';
        $type = 'external';
 
        $urlInfo = @parse_url($url);
        if ($urlInfo)
        {
            $host = $urlInfo['host'] . (!empty($urlInfo['port']) ? ":$urlInfo[port]" : '');
            if ($host == XenForo_Application::$host)...
Read more about this resource...
 

Chris D

XenForo developer
Staff member
#2
I hate to say this as you've clearly put some effort into this but:

1) Editing core XenForo files is highly not recommended.
2) By default in XenForo all links created by members are assigned the rel="nofollow" attribute. No action is required for this to work.

Example: http://www.valvetime.net

View source:

nofollow.PNG

URLs posted by staff do not have this attribute, but that's on the assumptions that your staff won't spam.
 

zooki

Active member
#6
I hate to say this as you've clearly put some effort into this but:

1) Editing core XenForo files is highly not recommended.
2) By default in XenForo all links created by members are assigned the rel="nofollow" attribute. No action is required for this to work.

Example: http://www.valvetime.net

View source:

View attachment 29773

URLs posted by staff do not have this attribute, but that's on the assumptions that your staff won't spam.
Super ! : ) never knew this
 

akhilaniyan

Active member
#7
Is this modification works with xenforo 1.2?

Will this modification have the ability to set nofollow to admin and moderators too?
 
#8
There should be some option in Xenforo to change default settings for links. Being a moderator, when I link to other websites in answers for reference, I want my links to have nofollow. Is there a way to do that?