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

hkda_vietnam

New member
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...
 
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.webp

URLs posted by staff do not have this attribute, but that's on the assumptions that your staff won't spam.
 
Regardless it is a submission to the RM. If you believe it to not be of any value, rate it as such using the rating system.

Thankyou
 
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
 
Is this modification works with xenforo 1.2?

Will this modification have the ability to set nofollow to admin and moderators too?
 
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?
 
Top Bottom