wordpress深度seo优化教程 – 新站高度集权优化方案
2013-12-12 22:12
676 查看
昨天小V写了一篇关于wordpress的canonical标签的文章,不知道大家有没有发现在百度知道的源代码截图中发现这么一段
好了接下来说正题,不知道大家发现了没有,wordpress的分类目录的分页以及标签页的分页其实在搜索引擎中排名并不好,而且也没什么实质性内容,那么我们可以通过
<meta name="robots" content="noindex,follow" />那么这段代码的作用是什么呢?据robotstxt.org官方网站解释,这段代码作用是屏蔽搜索引擎对本页面的收录但是允许抓取该页面上的链接。那么为什么百度知道的SEO工作人员会把这么一条meta标签写在页面上呢?经过小V的观察发现百度知道所有的动态链接页面上都会包含一条这样的meta标签,但是进入该页面的伪静态链接却不会出现该meta标签,那么这样看来百度知道官方的SEOER意图很明显啊,是为了减少不必要的收录,来集中网站的权重。
好了接下来说正题,不知道大家发现了没有,wordpress的分类目录的分页以及标签页的分页其实在搜索引擎中排名并不好,而且也没什么实质性内容,那么我们可以通过
<meta name="robots" content="noindex,follow" />标签来进行屏蔽以达到减少不必要的收录集中网站权重的效果,实现方法,打开主题的头部文件(一般情况下为header.php)在其中添加以下代码:
<?php if(is_home()) { ?> <?php $paged = get_query_var('paged'); if ( $paged > 1 ) echo'<meta name="robots" content="noindex,follow" />'; ?> <?php } ?> <?php if(is_category()) { ?> <?php $paged = get_query_var('paged'); if ( $paged > 1 ) echo'<meta name="robots" content="noindex,follow" />'; ?> <?php } ?> <?php if(is_tag()) { ?> <?php $paged = get_query_var('paged'); if ( $paged > 1 ) echo'<meta name="robots" content="noindex,follow" />'; ?> <?php }?>做完了网站收录处理,接下来在用nofollow属性减少下页面权重流失集中内页权重,代码如下:
//阅读更多链接添加nofollow add_filter('the_content_more_link','add_nofollow_to_link', 0); function add_nofollow_to_link($link) { return str_replace('<a', '<a rel="nofollow"', $link); } //标签云添加nofollow add_filter('wp_tag_cloud', 'cis_nofollow_tag_cloud'); function cis_nofollow_tag_cloud($text) { return str_replace('<a href=', '<a rel="nofollow" href=',$text); } //内容页tag链接添加nofollow add_filter('the_tags', 'cis_nofollow_the_tag'); function cis_nofollow_the_tag($text) { return str_replace('rel="tag"', 'rel="tag nofollow"', $text); } //作者归档链接添加nofollow add_filter('the_author_posts_link', 'cis_nofollow_the_author_posts_link'); function cis_nofollow_the_author_posts_link ($link) { return str_replace('</a><a href=', '<a rel="nofollow" href=',$link); } //访客评论链接添加nofollow add_filter('comments_popup_link_attributes', 'cis_nofollow_comments_popup_link_attributes'); function cis_nofollow_comments_popup_link_attributes () { echo 'rel="nofollow"'; }以上代码加到functions.php文件即可。
相关文章推荐
- wordpress深度seo优化教程 – canonical标签
- wordpress加速优化教程:多种Gravatar头像缓存方案
- 直播体验深度优化方案——连麦互动直播
- wordpress加速优化教程:非插件部署cdn加速(七牛、又拍云)
- wordpress站内搜索优化方案:伪静态、剔除无关内容
- 直播体验深度优化方案——连麦互动直播
- wordpress全站链接(URL)规范化优化方案
- wordpress加速优化教程:使用相对链接
- wordpress优化教程之页面执行效率查询
- wordpress加速优化教程:强制jquery库文件底部载入
- 新站之网站优化方案[优化]
- SEO优化教程:品牌产品推广方案(下)
- seo优化方案如何抒写之(站内优化)之网站设计
- Unity下XLua方案的各值类型GC优化深度剖析
- seo优化方案如何抒写之(站内优化)之网站设计
- wordpress新手网站优化教程
- wordpress深度优化禁用不常用功能加速网站
- wordpress开发教程:优化用户注册体验(自定义密码)
- wordpress数据库优化技巧(2) – 清除数据库沉余数据
- wordpress主题开发教程手记:wp-login.php登录页面优化