【问题标题】:Nofollow link for plugin links插件链接的 Nofollow 链接
【发布时间】:2014-03-10 08:33:42
【问题描述】:

http://www.onlineincomestartup.com/drive-traffic-to-your-website/ 中,在每个帖子中显示的作者简介中,

我需要制作除 Google plus 之外的所有链接,出于 SEO 目的不关注。我正在使用一个名为 WP 的关于作者的插件。我想我需要对以下代码进行更改。但我不是那么好在编辑代码。请有人帮忙。谢谢

// Generate social icons
function wp_about_author_get_social_links($wp_about_author_settings){
    $content="";
    $socials = wp_about_author_get_socials();
    foreach($socials as $social_key=>$social){
        if (get_the_author_meta($social_key)){
            if(isset($wp_about_author_settings['wp_author_social_images']) && $wp_about_author_settings['wp_author_social_images']){
                $content .= "<a class='wpa-social-icons' rel="nofollow" href='".str_replace('%%username%%', get_the_author_meta($social_key), $social['link'])."'><img src='". $social['icon']."' alt='".$social['title']."'/></a>";
            } else {
                if($content != "")
                    $content .= apply_filters( 'wp_about_author_separator', " - ");
                $content .= "<a href='".str_replace('%%username%%', get_the_author_meta($social_key), $social['link'])."'>".$social['title']."</a>";
            }
        }
    }
    return $content;
}

function wp_about_author_get_socials() {
    $socials = array();
    $socials['twitter'] = array('title'=>'Twitter', 'link'=>'http://www.twitter.com/%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/twitter.png');
    $socials['facebook'] = array('title'=>'Facebook', 'link'=>'http://www.facebook.com/%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/facebook.png');
    $socials['linkedin'] = array('title'=>'LinkedIn', 'link'=>'http://www.linkedin.com/in/%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/linkedin.png');
    $socials['pinterest'] = array('title'=>'Pinterest', 'link'=>'http://www.pinterest.com/%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/pinterest.png');
    $socials['googleplus'] = array('title'=>'Google Plus', 'link'=>'https://plus.google.com/%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/googleplus.png');
    $socials['digg'] = array('title'=>'Digg', 'link'=>'http://www.digg.com/%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/digg.png');
    $socials['flickr'] = array('title'=>'Flickr', 'link'=>'http://www.flickr.com/people/%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/flickr.png');
    $socials['stumbleupon'] = array('title'=>'StumbleUpon', 'link'=>'http://www.stumbleupon.com/stumbler/%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/stumbleupon.png');
    $socials['youtube'] = array('title'=>'YouTube', 'link'=>'http://www.youtube.com/user/%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/youtube.png');
    $socials['yelp'] = array('title'=>'Yelp', 'link'=>'http://www.yelp.com/user_details?userid=%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/yelp.png');
    $socials['reddit'] = array('title'=>'Reddit', 'link'=>'http://www.reddit.com/user/%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/reddit.png');
    $socials['delicious'] = array('title'=>'Delicious', 'link'=>'http://www.delicious.com/%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/delicious.png');
    return apply_filters( 'wp_about_author_get_socials', $socials );
}

【问题讨论】:

    标签: plugins seo wordpress nofollow


    【解决方案1】:

    您可以更改生成用户名链接的这一行

    $content .= "<a href='".str_replace('%%username%%', get_the_author_meta($social_key), $social['link'])."'>".$social['title']."</a>";
    

    $content .= "<a rel='nofollow' href='".str_replace('%%username%%', get_the_author_meta($social_key), $social['link'])."'>".$social['title']."</a>";
    

    这应该在您的链接中添加nofollow。

    【讨论】:

    • 谢谢!!那行得通。但是我需要制作除 Google plus 之外的所有链接,不要关注。这适用于所有链接。我不需要。有什么建议吗?
    【解决方案2】:

    我也有同样的要求。我的网站上有社交链接和图标,发现我们的网站正在传递数千个 dofollow 链接并耗尽我们的网站链接汁。经过一些研究,我发现 Rank Maths SEO 插件中有一个不错的小功能,它允许您实际选择某些域并将它们设置为全站点范围内的 nofollow。这真的很方便。但是,如果您已经在使用 yoast,则需要确保关闭所有 Rank Math 插件功能,并且只使用 nofollow 域选项。

    【讨论】:

    • 我也有同样的要求。您的网站是否受到处罚,这就是您想要不关注所有内容的原因?只要确保你也没有关注你的内部链接
    • 您的答案可以通过额外的支持信息得到改进。请edit 添加更多详细信息,例如引用或文档,以便其他人可以确认您的答案是正确的。你可以找到更多关于如何写好答案的信息in the help center
    猜你喜欢
    • 2011-03-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-08-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多