说起seo优化,我们以百度seo优化为主,百度旗下百度知道的seo做的非常好,权重非常之高,在众多站长之中百度知道是发外链的大型宣传平台,但百度知道如此高权重是如何做到的呢?下面来看下canonical标签。
方案一(canonical篇)
<link rel="canonical" href="http://zhidao.baidu.com/daily/view?id=810" />
canonical标签有什么作用?
对一组内容完全相同或高度相似的网页,通过使用canonical标签可以告诉搜索引擎哪个页面为规范的网页,能够规范网址并避免搜索结果中出现多个内容相同或相似的页面,帮助解决重复内容的收录问题,避免网站相同内容网页的重复展示及权重的分散,提升规范网页的权重,优化规范网页的排名。
那怎么在wordpress网站中使用canonical标签呢?方法如下:
⑴在functions.php文件中添加分类目录分页链接获取函数,代码如下:
function tongleer_archive_link( $paged = true ) { $link = false; if ( is_front_page() ) { $link = home_url( '/' ); } else if ( is_home() && "page" == get_option('show_on_front') ) { $link = get_permalink( get_option( 'page_for_posts' ) ); } else if ( is_tax() || is_tag() || is_category() ) { $term = get_queried_object(); $link = get_term_link( $term, $term->taxonomy ); } else if ( is_post_type_archive() ) { $link = get_post_type_archive_link( get_post_type() ); } else if ( is_author() ) { $link = get_author_posts_url( get_query_var('author'), get_query_var('author_name') ); } else if ( is_archive() ) { if ( is_date() ) { if ( is_day() ) { $link = get_day_link( get_query_var('year'), get_query_var('monthnum'), get_query_var('day') ); } else if ( is_month() ) { $link = get_month_link( get_query_var('year'), get_query_var('monthnum') ); } else if ( is_year() ) { $link = get_year_link( get_query_var('year') ); } } } if ( $paged && $link && get_query_var('paged') > 1 ) { global $wp_rewrite; if ( !$wp_rewrite->using_permalinks() ) { $link = add_query_arg( 'paged', get_query_var('paged'), $link ); } else { $link = user_trailingslashit( trailingslashit( $link ) . trailingslashit( $wp_rewrite->pagination_base ) . get_query_var('paged'), 'archive' ); } } return $link; }
⑵在header.php中插入如下代码:
<?php if(is_home()) { ?> <link rel="canonical" href="<?php echo tongleer_archive_link();?>"/> <?php } ?> <?php if(is_category()) { ?> <link rel="canonical" href="<?php echo tongleer_archive_link();?>"/> <?php } ?> <?php if(is_single()) { ?> <link rel="canonical" href="<?php the_permalink(); ?>"/> <?php }?> <?php if(is_tag()) { ?> <link rel="canonical" href="<?php echo tongleer_archive_link();?>"/> <?php }?>
这样就实现了在wordpress网站上添加了canonical标签,集中网站权重。
方案二(robots篇):
同样在百度知道中也会发现robots标签:
<meta name="robots" content="noindex,follow" />
因此robots标签集中权重的方法如下:
⑴在function.php中添加如下代码:
//阅读更多链接添加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"'; }
⑵在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 }?>
到这里,通过wordpress新站高度集中权重seo优化的两种方案,便可集中网站权重,防止没有实质性内容被搜索引擎所收录,快来加到你的网站中把。
1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2. 分享目的仅供大家学习和交流,您必须在下载后24小时内删除!
3. 不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
7. 如遇到加密压缩包,默认解压密码为"www.yuankufang.com",如遇到无法解压的请联系管理员!
源库坊 » wordpress新站高度集中权重seo优化方案,WordPress中nofollow标签的使用
2. 分享目的仅供大家学习和交流,您必须在下载后24小时内删除!
3. 不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
7. 如遇到加密压缩包,默认解压密码为"www.yuankufang.com",如遇到无法解压的请联系管理员!
源库坊 » wordpress新站高度集中权重seo优化方案,WordPress中nofollow标签的使用
常见问题FAQ
- 免费下载或者VIP会员专享资源能否直接商用?
- 本站所有资源版权均属于原作者所有,这里所提供资源均只能用于参考学习用,请勿直接商用。若由于商用引起版权纠纷,一切责任均由使用者承担。更多说明请参考 VIP介绍。
- 提示下载完但解压或打开不了?
- 找不到素材资源介绍文章里的示例图片?
- 源库坊