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

Dumb wp Question about links relating to SEO.

Discussion in 'Blogging' started by Bostoncab, Dec 8, 2010.

  1. Bostoncab

    Bostoncab Elite Member

    Joined:
    Dec 31, 2009
    Messages:
    2,255
    Likes Received:
    514
    Occupation:
    pain in the ass cabbie
    Location:
    Boston,Ma.
    Home Page:
    So we all know that links coming into your blog are good. The better and more links G sees at a steady rate the higher you rank for targeted keywords.

    Now I never really understood outbound links from your blog to outher sites and how that hurts seo.

    I know too many outbound links are bad and if you have outbound links they should be no follow.

    I have an autoblog set up that uses the autoblogged software. Every post it makes it drops a link back to the original article. So I must have hunreds of outbound links on my blog by now.

    Is there a way to set WP so that all outbound links are no follow? Meaning the link will still work but G won`t penalize me for the link because I have the no follow?
     
  2. extremephp

    extremephp BANNED BANNED

    Joined:
    Oct 19, 2010
    Messages:
    1,293
    Likes Received:
    1,272
    Yes! you can do that by adding a External No follow function!!

    So, your site will still have internal links to your pages, and all the other links will be NoFollow and hence you wont loose your Ranking to other sites!!

    Crack your functions.php and you can do what you just asked for!


    Add this to your functions.php

    Code:
    add_filter('the_content', 'my_nofollow');
    
    function my_nofollow($content) {
        //return stripslashes(wp_rel_nofollow($content));
        
        return preg_replace_callback('/<a[^>]+/', 'my_nofollow_callback', $content);
    }
    
    function my_nofollow_callback($matches) {
        $link = $matches[0];
        $site_link = get_bloginfo('url');
    
        if (strpos($link, 'rel') === false) {
            $link = preg_replace("%(href=\S(?!$site_link))%i", 'rel="nofollow" $1', $link);
        } elseif (preg_match("%href=\S(?!$site_link)%i", $link)) {
            $link = preg_replace('/rel=\S(?!nofollow)\S*/i', 'rel="nofollow"', $link);
        }
        return $link;
    }
    

    ~ExP~
     
  3. Bostoncab

    Bostoncab Elite Member

    Joined:
    Dec 31, 2009
    Messages:
    2,255
    Likes Received:
    514
    Occupation:
    pain in the ass cabbie
    Location:
    Boston,Ma.
    Home Page:
    Remind me to have you design my next theme.
     
  4. zenky

    zenky Newbie

    Joined:
    Nov 26, 2010
    Messages:
    32
    Likes Received:
    7
    remember add some trusty out link to wikipedia and similar sites
     
  5. Bostoncab

    Bostoncab Elite Member

    Joined:
    Dec 31, 2009
    Messages:
    2,255
    Likes Received:
    514
    Occupation:
    pain in the ass cabbie
    Location:
    Boston,Ma.
    Home Page:


    Why? I have heard this before but you really think you rank higher for links to authority pages?