中文字幕在线观看,亚洲а∨天堂久久精品9966,亚洲成a人片在线观看你懂的,亚洲av成人片无码网站,亚洲国产精品无码久久久五月天

WordPress SEO 技巧:內(nèi)鏈優(yōu)化

2019-03-15    來(lái)源:bolo的博客,blog.imbolo.com/wordpress-seo-tips

容器云強(qiáng)勢(shì)上線!快速搭建集群,上萬(wàn)Linux鏡像隨意使用

最近在做一個(gè)新網(wǎng)站,Google 剛開始收錄的時(shí)候發(fā)現(xiàn)歸檔頁(yè)面的排名比文章還高,猜測(cè)原因是歸檔頁(yè)面獲得的內(nèi)鏈太多了,因此產(chǎn)生一個(gè)把所有的指向歸檔頁(yè)面的鏈接全部加上 rel=”nofollow” 屬性的想法。

要達(dá)到這個(gè)目的,我們完全可以用 WordPress 強(qiáng)大的 filter 來(lái)實(shí)現(xiàn)。打開主題的 functions.php ,在里面加上以下的代碼:

//給標(biāo)簽云里的鏈接加上 rel="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);
}
 
//給 the_tags() 生成的鏈接 加上 rel="nofollow"
add_filter('the_tags', 'cis_nofollow_the_tag');
function cis_nofollow_the_tag($text) {
return str_replace('rel="tag"', 'rel="tag nofollow"', $text);
}
 
//給 wp_list_categories() 生成的鏈接加上 rel="nofollow"
add_filter( 'wp_list_categories', 'cis_nofollow_wp_list_categories' );
function cis_nofollow_wp_list_categories( $text ) {
 
$text = stripslashes($text);
$text = preg_replace_callback('|<a (.+?)>|i', 'wp_rel_nofollow_callback', $text);
return $text;
}
 
//給 the_category() 生成的鏈接加上 rel="nofollow"
add_filter( 'the_category', 'cis_nofollow_the_category' );
function cis_nofollow_the_category( $text ) {
 
$text = str_replace('rel="category tag"', "", $text);
$text = cis_nofollow_wp_list_categories($text);
return $text;
}
 
//給 the_author_post_link 生成的鏈接加上 rel="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);
}
 
//給 comments_popup_link_attributes() 生成的鏈接加上 rel="nofollow"
add_filter('comments_popup_link_attributes', 'cis_nofollow_comments_popup_link_attributes');
function cis_nofollow_comments_popup_link_attributes () {
echo ' rel="nofollow"';
}

上面的 filter 針對(duì)的都是主題開發(fā)時(shí)一些使用率比較高的函數(shù),基本上已經(jīng)能滿足我的要求了。

(來(lái)源:bolo的博客

標(biāo)簽: WordPress SEO技巧 頁(yè)面排名 

版權(quán)申明:本站文章部分自網(wǎng)絡(luò),如有侵權(quán),請(qǐng)聯(lián)系:west999com@outlook.com
特別注意:本站所有轉(zhuǎn)載文章言論不代表本站觀點(diǎn)!
本站所提供的圖片等素材,版權(quán)歸原作者所有,如需使用,請(qǐng)與原作者聯(lián)系。

上一篇:一個(gè)ICO小圖標(biāo),百度給你全新體驗(yàn)

下一篇:問(wèn)答平臺(tái)推廣乃網(wǎng)站SEO一大利器