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

XF 1.1 SEO: Handling external links

Discussion in 'XenForo Questions and Support' started by zeropaid, May 19, 2013.

  1. zeropaid

    zeropaid Member

    I've noticed that in my posts when a user posts a link to an external link, rel='external nofollow' is not attached to links. Since my domain is high ranking, spammers see this as a dangling carrot.

    What is the best way to handle external links in xenForo?
  2. Brogan

    Brogan XenForo Moderator Staff Member

    All links posted are nofollow, except those by staff.
    DeltaHF and zeropaid like this.
  3. zeropaid

    zeropaid Member

    @brogan, is there a way to turn this on for all external links?
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    That would deter spammers, not attract them. Their spam links will carry no weight with search engines. You want to change this?

    You want to make staff links nofollow as well? Edit this file:


    Add the red code:

    	 * Prepares a user record for display. Note that this may be called on incomplete guest records.
    	 * @param array $user User info
    	 * @return array Prepared user info
    	public function prepareUser(array $user)
    		if (empty($user['user_group_id']))
    			$user['display_style_group_id'] = self::$defaultGuestGroupId;
    		$user['customFields'] = (!empty($user['custom_fields']) ? @unserialize($user['custom_fields']) : array());
    		// "trusted" user check - used to determine if no follow is enabled
    		$user['isTrusted'] = (false && !empty($user['user_id']) && (!empty($user['is_admin']) || !empty($user['is_moderator'])));
    		if (XenForo_Visitor::hasInstance())
    			$user['isIgnored'] = XenForo_Visitor::getInstance()->isIgnoring($user['user_id']);
    		return $user;
    That will remove the exception for admins and mods which will cause all hyperlinks in user content to be "nofollow".

    edit - this can be made into an addon by extending XenForo_Model_User.
    zeropaid likes this.

Share This Page