WordPress快速向首页集中权重如何操作

wordpress新站高度集中权重seo优化方案,WordPress中nofollow标签的使用。说起seo优化,我们以百度seo优化为主,百度旗下百度知道的seo做的非常好,权重非常之高,在众多站长之中百度知道是发外链的大型宣传平台,但百度知道如此高权重是如何做到的呢?WordPress快速向首页集中权重如何操作呢?

WordPress快速向首页集中权重如何操作

WordPress快速向首页集中权重如何操作

下面来看下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优化的两种方案,便可集中网站权重,防止没有实质性内容被搜索引擎所收录,快来加到你的网站中把。

你是如何看待坐副驾驶的网红一霖? 她有100万抖音粉丝

上一篇

古风博客给新手网站的SEO优化建议

下一篇

99%的人还看了

发表评论

插入图片

欢迎登陆本站

 | 注册

在线工具

VIP视频解析
注册

登录

忘记密码 ?