从SEO角度出发,我们应该禁止搜索引擎对网站分页的抓取
时间:2年前 游览量:323 标签: nbsp quot 39 内容
我们采用wordpress进行网站建设的时候,在评论的分页的时候,其实是存在重复内容的,因为评论分页的内容正文都一样,并且 keywords 和 description 也相同,这样对搜索引擎来说,是不友好的,存在恶意重复内容,会被降权之说,那么,我们应该禁止搜索引擎对网站分页的抓取!
方法就是,在主题文件的header.php头部文件里,加个判定,然后用
<meta name="robots" content="noindex, nofollow" />
来进行禁止抓取!下面直接给完整代码吧:
<?php if( is_single() || is_page() ) {
if( function_exists('get_query_var') ) {
$cpage = intval(get_query_var('cpage'));
$commentPage = intval(get_query_var('comment-page'));
}
if( !emptyempty($cpage) || !emptyempty($commentPage) ) {
echo '<meta name="robots" content="noindex, nofollow" />';
echo "\n";
}
}
?>
在原有的 meta 标签下加入以上代码即可!OK。。。