有些时候我们需要在某个特定的分类目录下的文章链接添加nofollow的属性,比如放置软件下载文章的分类目录,这样做可以防止搜索引擎降权。对于这样的情况,可以用几行简单的代码来解决:
function nofollow_cat_posts($text) { global $post; if( in_category(1) ) { // SET CATEGORY ID HERE $text = stripslashes(wp_rel_nofollow($text)); } return $text; } add_filter('the_content', 'nofollow_cat_posts');
in_category(1)中的数字为分类目录ID,在WP后台的文章→分类目录,点击任意一个分类目录,地址中会有一段类似于taxonomy=category&tag_ID=6&post_type=post,其中的ID=6就是所要找的分类目录ID。
我感觉nofollow也算外链,在统计的时候也会统计上
@大发 对SEO好像会有些影响…… 在以前的博友那看到了http://www.yiduqiang.com/ipc-me.html……
…..这文章啊。。。。
@Cry紫瞳 …其实这都不算文章
我把这个取消了···直接把外链转内链了··我想知道,博主这个内页分享条后面的评分是什么?
@cy 插件来自postratings