WordPress技巧:新站高度集中权重seo优化方案,WordPress中nofollow标签的使用

方案一(canonical篇):

  1. <span class="tag">&lt;</span><span class="hljs-keyword"><span class="tag">link</span></span><span class="pln"> </span><span class="atn">rel</span><span class="pun">=</span><span class="hljs-string"><span class="atv">"canonical"</span></span><span class="pln"> </span><span class="atn">href</span><span class="pun">=</span><span class="hljs-string"><span class="atv">"http://zhidao.baidu.com/daily/view?id=810"</span></span><span class="pln"> </span><span class="tag">/&gt;</span>

     

canonical标签有什么作用?

对一组内容完全相同或高度相似的网页,通过使用canonical标签可以告诉搜索引擎哪个页面为规范的网页,能够规范网址并避免搜索结果中出现多个内容相同或相似的页面,帮助解决重复内容的收录问题,避免网站相同内容网页的重复展示及权重的分散,提升规范网页的权重,优化规范网页的排名。

那怎么在wordpress网站中使用canonical标签呢?方法如下:

⑴在functions.php文件中添加分类目录分页链接获取函数,代码如下:

<span class="hljs-function"><span class="hljs-keyword"><span class="kwd">function</span></span><span class="pln"> </span><span class="hljs-title"><span class="pln">tongleer_archive_link</span></span><span class="hljs-params"><span class="pun">(</span><span class="pln"> $paged </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">true</span><span class="pln"> </span><span class="pun">)</span></span><span class="pln"> </span></span><span class="pun">{</span><span class="pln">
        $link </span><span class="pun">=</span><span class="pln"> </span><span class="hljs-keyword"><span class="kwd">false</span></span><span class="pun">;</span><span class="pln">
        </span><span class="hljs-keyword"><span class="kwd">if</span></span><span class="pln"> </span><span class="pun">(</span><span class="pln"> is_front_page</span><span class="pun">()</span><span class="pln"> </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
                $link </span><span class="pun">=</span><span class="pln"> home_url</span><span class="pun">(</span><span class="pln"> </span><span class="hljs-string"><span class="str">'/'</span></span><span class="pln"> </span><span class="pun">);</span><span class="pln">
        </span><span class="pun">}</span><span class="pln"> </span><span class="hljs-keyword"><span class="kwd">else</span></span><span class="pln"> </span><span class="hljs-keyword"><span class="kwd">if</span></span><span class="pln"> </span><span class="pun">(</span><span class="pln"> is_home</span><span class="pun">()</span><span class="pln"> </span><span class="pun">&amp;&amp;</span><span class="pln"> </span><span class="hljs-string"><span class="str">"page"</span></span><span class="pln"> </span><span class="pun">==</span><span class="pln"> get_option</span><span class="pun">(</span><span class="hljs-string"><span class="str">'show_on_front'</span></span><span class="pun">)</span><span class="pln"> </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
                $link </span><span class="pun">=</span><span class="pln"> get_permalink</span><span class="pun">(</span><span class="pln"> get_option</span><span class="pun">(</span><span class="pln"> </span><span class="hljs-string"><span class="str">'page_for_posts'</span></span><span class="pln"> </span><span class="pun">)</span><span class="pln"> </span><span class="pun">);</span><span class="pln">
        </span><span class="pun">}</span><span class="pln"> </span><span class="hljs-keyword"><span class="kwd">else</span></span><span class="pln"> </span><span class="hljs-keyword"><span class="kwd">if</span></span><span class="pln"> </span><span class="pun">(</span><span class="pln"> is_tax</span><span class="pun">()</span><span class="pln"> </span><span class="pun">||</span><span class="pln"> is_tag</span><span class="pun">()</span><span class="pln"> </span><span class="pun">||</span><span class="pln"> is_category</span><span class="pun">()</span><span class="pln"> </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
                $term </span><span class="pun">=</span><span class="pln"> get_queried_object</span><span class="pun">();</span><span class="pln">
                $link </span><span class="pun">=</span><span class="pln"> get_term_link</span><span class="pun">(</span><span class="pln"> $term</span><span class="pun">,</span><span class="pln"> $term</span><span class="pun">-&gt;</span><span class="pln">taxonomy </span><span class="pun">);</span><span class="pln">
        </span><span class="pun">}</span><span class="pln"> </span><span class="hljs-keyword"><span class="kwd">else</span></span><span class="pln"> </span><span class="hljs-keyword"><span class="kwd">if</span></span><span class="pln"> </span><span class="pun">(</span><span class="pln"> is_post_type_archive</span><span class="pun">()</span><span class="pln"> </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
                $link </span><span class="pun">=</span><span class="pln"> get_post_type_archive_link</span><span class="pun">(</span><span class="pln"> get_post_type</span><span class="pun">()</span><span class="pln"> </span><span class="pun">);</span><span class="pln">
        </span><span class="pun">}</span><span class="pln"> </span><span class="hljs-keyword"><span class="kwd">else</span></span><span class="pln"> </span><span class="hljs-keyword"><span class="kwd">if</span></span><span class="pln"> </span><span class="pun">(</span><span class="pln"> is_author</span><span class="pun">()</span><span class="pln"> </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
                $link </span><span class="pun">=</span><span class="pln"> get_author_posts_url</span><span class="pun">(</span><span class="pln"> get_query_var</span><span class="pun">(</span><span class="hljs-string"><span class="str">'author'</span></span><span class="pun">),</span><span class="pln"> get_query_var</span><span class="pun">(</span><span class="hljs-string"><span class="str">'author_name'</span></span><span class="pun">)</span><span class="pln"> </span><span class="pun">);</span><span class="pln">
        </span><span class="pun">}</span><span class="pln"> </span><span class="hljs-keyword"><span class="kwd">else</span></span><span class="pln"> </span><span class="hljs-keyword"><span class="kwd">if</span></span><span class="pln"> </span><span class="pun">(</span><span class="pln"> is_archive</span><span class="pun">()</span><span class="pln"> </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
                </span><span class="hljs-keyword"><span class="kwd">if</span></span><span class="pln"> </span><span class="pun">(</span><span class="pln"> is_date</span><span class="pun">()</span><span class="pln"> </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
                        </span><span class="hljs-keyword"><span class="kwd">if</span></span><span class="pln"> </span><span class="pun">(</span><span class="pln"> is_day</span><span class="pun">()</span><span class="pln"> </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
                                $link </span><span class="pun">=</span><span class="pln"> get_day_link</span><span class="pun">(</span><span class="pln"> get_query_var</span><span class="pun">(</span><span class="hljs-string"><span class="str">'year'</span></span><span class="pun">),</span><span class="pln"> get_query_var</span><span class="pun">(</span><span class="hljs-string"><span class="str">'monthnum'</span></span><span class="pun">),</span><span class="pln"> get_query_var</span><span class="pun">(</span><span class="hljs-string"><span class="str">'day'</span></span><span class="pun">)</span><span class="pln"> </span><span class="pun">);</span><span class="pln">
                        </span><span class="pun">}</span><span class="pln"> </span><span class="hljs-keyword"><span class="kwd">else</span></span><span class="pln"> </span><span class="hljs-keyword"><span class="kwd">if</span></span><span class="pln"> </span><span class="pun">(</span><span class="pln"> is_month</span><span class="pun">()</span><span class="pln"> </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
                                $link </span><span class="pun">=</span><span class="pln"> get_month_link</span><span class="pun">(</span><span class="pln"> get_query_var</span><span class="pun">(</span><span class="hljs-string"><span class="str">'year'</span></span><span class="pun">),</span><span class="pln"> get_query_var</span><span class="pun">(</span><span class="hljs-string"><span class="str">'monthnum'</span></span><span class="pun">)</span><span class="pln"> </span><span class="pun">);</span><span class="pln">
                        </span><span class="pun">}</span><span class="pln"> </span><span class="hljs-keyword"><span class="kwd">else</span></span><span class="pln"> </span><span class="hljs-keyword"><span class="kwd">if</span></span><span class="pln"> </span><span class="pun">(</span><span class="pln"> is_year</span><span class="pun">()</span><span class="pln"> </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
                                $link </span><span class="pun">=</span><span class="pln"> get_year_link</span><span class="pun">(</span><span class="pln"> get_query_var</span><span class="pun">(</span><span class="hljs-string"><span class="str">'year'</span></span><span class="pun">)</span><span class="pln"> </span><span class="pun">);</span><span class="pln">
                        </span><span class="pun">}</span><span class="pln">
                </span><span class="pun">}</span><span class="pln">
        </span><span class="pun">}</span><span class="pln">
        </span><span class="hljs-keyword"><span class="kwd">if</span></span><span class="pln"> </span><span class="pun">(</span><span class="pln"> $paged </span><span class="pun">&amp;&amp;</span><span class="pln"> $link </span><span class="pun">&amp;&amp;</span><span class="pln"> get_query_var</span><span class="pun">(</span><span class="hljs-string"><span class="str">'paged'</span></span><span class="pun">)</span><span class="pln"> </span><span class="pun">&gt;</span><span class="pln"> </span><span class="hljs-number"><span class="lit">1</span></span><span class="pln"> </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
                </span><span class="hljs-keyword"><span class="kwd">global</span></span><span class="pln"> $wp_rewrite</span><span class="pun">;</span><span class="pln">
                </span><span class="hljs-keyword"><span class="kwd">if</span></span><span class="pln"> </span><span class="pun">(</span><span class="pln"> </span><span class="pun">!</span><span class="pln">$wp_rewrite</span><span class="pun">-&gt;</span><span class="pln">using_permalinks</span><span class="pun">()</span><span class="pln"> </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
                        $link </span><span class="pun">=</span><span class="pln"> add_query_arg</span><span class="pun">(</span><span class="pln"> </span><span class="hljs-string"><span class="str">'paged'</span></span><span class="pun">,</span><span class="pln"> get_query_var</span><span class="pun">(</span><span class="hljs-string"><span class="str">'paged'</span></span><span class="pun">),</span><span class="pln"> $link </span><span class="pun">);</span><span class="pln">
                </span><span class="pun">}</span><span class="pln"> </span><span class="hljs-keyword"><span class="kwd">else</span></span><span class="pln"> </span><span class="pun">{</span><span class="pln">
                        $link </span><span class="pun">=</span><span class="pln"> user_trailingslashit</span><span class="pun">(</span><span class="pln"> trailingslashit</span><span class="pun">(</span><span class="pln"> $link </span><span class="pun">)</span><span class="pln"> </span><span class="pun">.</span><span class="pln"> trailingslashit</span><span class="pun">(</span><span class="pln"> $wp_rewrite</span><span class="pun">-&gt;</span><span class="pln">pagination_base </span><span class="pun">)</span><span class="pln"> </span><span class="pun">.</span><span class="pln"> get_query_var</span><span class="pun">(</span><span class="hljs-string"><span class="str">'paged'</span></span><span class="pun">),</span><span class="pln"> </span><span class="hljs-string"><span class="str">'archive'</span></span><span class="pln"> </span><span class="pun">);</span><span class="pln">
                </span><span class="pun">}</span><span class="pln">
        </span><span class="pun">}</span><span class="pln">
        </span><span class="hljs-keyword"><span class="kwd">return</span></span><span class="pln"> $link</span><span class="pun">;</span>
<span class="pun">}</span>

 

⑵在header.php中插入如下代码:

<span class="php"><span class="hljs-meta"><span class="pun">&lt;?</span><span class="pln">php</span></span>
<span class="hljs-keyword"><span class="kwd">if</span></span><span class="pun">(</span><span class="pln">is_home</span><span class="pun">())</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="hljs-meta"><span class="pun">?&gt;</span></span></span>
<span class="hljs-tag"><span class="pln">&lt;</span><span class="hljs-name"><span class="pln">link</span></span><span class="pln"> </span><span class="hljs-attr"><span class="pln">rel</span></span><span class="pln">=</span><span class="hljs-string"><span class="pln">"canonical"</span></span><span class="pln"> </span><span class="hljs-attr"><span class="pln">href</span></span><span class="pln">=</span><span class="hljs-string"><span class="pln">"</span><span class="php"><span class="hljs-meta"><span class="pun">&lt;?</span><span class="pln">php</span></span><span class="pln"> </span><span class="hljs-keyword"><span class="pln">echo</span></span><span class="pln"> tongleer_archive_link</span><span class="pun">();</span><span class="hljs-meta"><span class="pun">?&gt;</span></span></span><span class="pln">"</span></span><span class="pln">/&gt;</span></span>
<span class="php"><span class="hljs-meta"><span class="pun">&lt;?</span><span class="pln">php</span></span><span class="pln"> </span><span class="pun">}</span><span class="pln"> </span><span class="hljs-meta"><span class="pun">?&gt;</span></span></span>
<span class="php"><span class="hljs-meta"><span class="pun">&lt;?</span><span class="pln">php</span></span>
<span class="hljs-keyword"><span class="kwd">if</span></span><span class="pun">(</span><span class="pln">is_category</span><span class="pun">())</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="hljs-meta"><span class="pun">?&gt;</span></span></span>
<span class="hljs-tag"><span class="pln">&lt;</span><span class="hljs-name"><span class="pln">link</span></span><span class="pln"> </span><span class="hljs-attr"><span class="pln">rel</span></span><span class="pln">=</span><span class="hljs-string"><span class="pln">"canonical"</span></span><span class="pln"> </span><span class="hljs-attr"><span class="pln">href</span></span><span class="pln">=</span><span class="hljs-string"><span class="pln">"</span><span class="php"><span class="hljs-meta"><span class="pun">&lt;?</span><span class="pln">php</span></span><span class="pln"> </span><span class="hljs-keyword"><span class="pln">echo</span></span><span class="pln"> tongleer_archive_link</span><span class="pun">();</span><span class="hljs-meta"><span class="pun">?&gt;</span></span></span><span class="pln">"</span></span><span class="pln">/&gt;</span></span>
<span class="php"><span class="hljs-meta"><span class="pun">&lt;?</span><span class="pln">php</span></span><span class="pln"> </span><span class="pun">}</span><span class="pln"> </span><span class="hljs-meta"><span class="pun">?&gt;</span></span></span>
<span class="php"><span class="hljs-meta"><span class="pun">&lt;?</span><span class="pln">php</span></span>
<span class="hljs-keyword"><span class="kwd">if</span></span><span class="pun">(</span><span class="pln">is_single</span><span class="pun">())</span><span class="pln">  </span><span class="pun">{</span><span class="pln"> </span><span class="hljs-meta"><span class="pun">?&gt;</span></span></span>
<span class="hljs-tag"><span class="pln">&lt;</span><span class="hljs-name"><span class="pln">link</span></span><span class="pln"> </span><span class="hljs-attr"><span class="pln">rel</span></span><span class="pln">=</span><span class="hljs-string"><span class="pln">"canonical"</span></span><span class="pln"> </span><span class="hljs-attr"><span class="pln">href</span></span><span class="pln">=</span><span class="hljs-string"><span class="pln">"</span><span class="php"><span class="hljs-meta"><span class="pun">&lt;?</span><span class="pln">php</span></span><span class="pln"> the_permalink</span><span class="pun">();</span><span class="pln"> </span><span class="hljs-meta"><span class="pun">?&gt;</span></span></span><span class="pln">"</span></span><span class="pln">/&gt;</span></span>
<span class="php"><span class="hljs-meta"><span class="pun">&lt;?</span><span class="pln">php</span></span><span class="pln"> </span><span class="pun">}</span><span class="hljs-meta"><span class="pun">?&gt;</span></span></span>
<span class="php"><span class="hljs-meta"><span class="pun">&lt;?</span><span class="pln">php</span></span>
<span class="hljs-keyword"><span class="kwd">if</span></span><span class="pun">(</span><span class="pln">is_tag</span><span class="pun">())</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="hljs-meta"><span class="pun">?&gt;</span></span></span>
<span class="hljs-tag"><span class="pln">&lt;</span><span class="hljs-name"><span class="pln">link</span></span><span class="pln"> </span><span class="hljs-attr"><span class="pln">rel</span></span><span class="pln">=</span><span class="hljs-string"><span class="pln">"canonical"</span></span><span class="pln"> </span><span class="hljs-attr"><span class="pln">href</span></span><span class="pln">=</span><span class="hljs-string"><span class="pln">"</span><span class="php"><span class="hljs-meta"><span class="pun">&lt;?</span><span class="pln">php</span></span><span class="pln"> </span><span class="hljs-keyword"><span class="pln">echo</span></span><span class="pln"> tongleer_archive_link</span><span class="pun">();</span><span class="hljs-meta"><span class="pun">?&gt;</span></span></span><span class="pln">"</span></span><span class="pln">/&gt;</span></span>
<span class="php"><span class="hljs-meta"><span class="pun">&lt;?</span><span class="pln">php</span></span><span class="pln"> </span><span class="pun">}</span><span class="hljs-meta"><span class="pun">?&gt;</span></span></span>

 

WP教程这样就实现了在wordpress网站上添加了canonical标签,集中网站权重。

方案二(robots篇):

同样在百度知道中也会发现robots标签:

<span class="hljs-tag"><span class="tag">&lt;</span><span class="hljs-name"><span class="tag">meta</span></span><span class="pln"> </span><span class="hljs-attr"><span class="atn">name</span></span><span class="pun">=</span><span class="hljs-string"><span class="atv">"robots"</span></span><span class="pln"> </span><span class="hljs-attr"><span class="atn">content</span></span><span class="pun">=</span><span class="hljs-string"><span class="atv">"noindex,follow"</span></span><span class="pln"> </span><span class="tag">/&gt;</span></span>

 

因此robots标签集中权重的方法如下:

⑴在function.php中添加如下代码:

<span class="hljs-comment"><span class="com">//阅读更多链接添加nofollow</span></span><span class="pln">
add_filter</span><span class="pun">(</span><span class="hljs-string"><span class="str">'the_content_more_link'</span></span><span class="pun">,</span><span class="hljs-string"><span class="str">'add_nofollow_to_link'</span></span><span class="pun">,</span><span class="pln"> </span><span class="hljs-number"><span class="lit">0</span></span><span class="pun">);</span>
<span class="hljs-function"><span class="hljs-keyword"><span class="kwd">function</span></span><span class="pln"> </span><span class="hljs-title"><span class="pln">add_nofollow_to_link</span></span><span class="hljs-params"><span class="pun">(</span><span class="pln">$link</span><span class="pun">)</span></span><span class="pln"> </span></span><span class="pun">{</span>
<span class="hljs-keyword"><span class="kwd">return</span></span><span class="pln"> str_replace</span><span class="pun">(</span><span class="hljs-string"><span class="str">'&lt;a'</span></span><span class="pun">,</span><span class="pln"> </span><span class="hljs-string"><span class="str">'&lt;a rel="nofollow"'</span></span><span class="pun">,</span><span class="pln"> $link</span><span class="pun">);</span>
<span class="pun">}</span>
<span class="hljs-comment"><span class="com">//标签云添加nofollow</span></span><span class="pln">
add_filter</span><span class="pun">(</span><span class="hljs-string"><span class="str">'wp_tag_cloud'</span></span><span class="pun">,</span><span class="pln"> </span><span class="hljs-string"><span class="str">'cis_nofollow_tag_cloud'</span></span><span class="pun">);</span>
<span class="hljs-function"><span class="hljs-keyword"><span class="kwd">function</span></span><span class="pln"> </span><span class="hljs-title"><span class="pln">cis_nofollow_tag_cloud</span></span><span class="hljs-params"><span class="pun">(</span><span class="pln">$text</span><span class="pun">)</span></span><span class="pln"> </span></span><span class="pun">{</span><span class="pln">
    </span><span class="hljs-keyword"><span class="kwd">return</span></span><span class="pln"> str_replace</span><span class="pun">(</span><span class="hljs-string"><span class="str">'&lt;a href='</span></span><span class="pun">,</span><span class="pln"> </span><span class="hljs-string"><span class="str">'&lt;a rel="nofollow" href='</span></span><span class="pun">,</span><span class="pln">$text</span><span class="pun">);</span>
<span class="pun">}</span>
<span class="hljs-comment"><span class="com">//内容页tag链接添加nofollow</span></span><span class="pln">
add_filter</span><span class="pun">(</span><span class="hljs-string"><span class="str">'the_tags'</span></span><span class="pun">,</span><span class="pln"> </span><span class="hljs-string"><span class="str">'cis_nofollow_the_tag'</span></span><span class="pun">);</span>
<span class="hljs-function"><span class="hljs-keyword"><span class="kwd">function</span></span><span class="pln"> </span><span class="hljs-title"><span class="pln">cis_nofollow_the_tag</span></span><span class="hljs-params"><span class="pun">(</span><span class="pln">$text</span><span class="pun">)</span></span><span class="pln"> </span></span><span class="pun">{</span><span class="pln">
    </span><span class="hljs-keyword"><span class="kwd">return</span></span><span class="pln"> str_replace</span><span class="pun">(</span><span class="hljs-string"><span class="str">'rel="tag"'</span></span><span class="pun">,</span><span class="pln"> </span><span class="hljs-string"><span class="str">'rel="tag nofollow"'</span></span><span class="pun">,</span><span class="pln"> $text</span><span class="pun">);</span>
<span class="pun">}</span>
<span class="hljs-comment"><span class="com">//作者归档链接添加nofollow</span></span><span class="pln">
add_filter</span><span class="pun">(</span><span class="hljs-string"><span class="str">'the_author_posts_link'</span></span><span class="pun">,</span><span class="pln"> </span><span class="hljs-string"><span class="str">'cis_nofollow_the_author_posts_link'</span></span><span class="pun">);</span>
<span class="hljs-function"><span class="hljs-keyword"><span class="kwd">function</span></span><span class="pln"> </span><span class="hljs-title"><span class="pln">cis_nofollow_the_author_posts_link</span></span><span class="pln"> </span><span class="hljs-params"><span class="pun">(</span><span class="pln">$link</span><span class="pun">)</span></span><span class="pln"> </span></span><span class="pun">{</span>
<span class="hljs-keyword"><span class="kwd">return</span></span><span class="pln"> str_replace</span><span class="pun">(</span><span class="hljs-string"><span class="str">'&lt;/a&gt;&lt;a href='</span></span><span class="pun">,</span><span class="pln"> </span><span class="hljs-string"><span class="str">'&lt;a rel="nofollow" href='</span></span><span class="pun">,</span><span class="pln">$link</span><span class="pun">);</span>
<span class="pun">}</span>
<span class="hljs-comment"><span class="com">//访客评论链接添加nofollow</span></span><span class="pln">
add_filter</span><span class="pun">(</span><span class="hljs-string"><span class="str">'comments_popup_link_attributes'</span></span><span class="pun">,</span><span class="pln"> </span><span class="hljs-string"><span class="str">'cis_nofollow_comments_popup_link_attributes'</span></span><span class="pun">);</span>
<span class="hljs-function"><span class="hljs-keyword"><span class="kwd">function</span></span><span class="pln"> </span><span class="hljs-title"><span class="pln">cis_nofollow_comments_popup_link_attributes</span></span><span class="pln"> </span><span class="hljs-params"><span class="pun">()</span></span><span class="pln"> </span></span><span class="pun">{</span>
<span class="hljs-keyword"><span class="pln">echo</span></span><span class="pln"> </span><span class="hljs-string"><span class="str">'rel="nofollow"'</span></span><span class="pun">;</span>
<span class="pun">}</span>

 

⑵在header.php中加入如下代码:

<span class="php"><span class="hljs-meta"><span class="pun">&lt;?</span><span class="pln">php</span></span>
<span class="hljs-keyword"><span class="kwd">if</span></span><span class="pun">(</span><span class="pln">is_home</span><span class="pun">())</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="hljs-meta"><span class="pun">?&gt;</span></span></span>
<span class="php"><span class="hljs-meta"><span class="pun">&lt;?</span><span class="pln">php</span></span><span class="pln"> $paged </span><span class="pun">=</span><span class="pln"> get_query_var</span><span class="pun">(</span><span class="hljs-string"><span class="str">'paged'</span></span><span class="pun">);</span>
<span class="hljs-keyword"><span class="kwd">if</span></span><span class="pln"> </span><span class="pun">(</span><span class="pln"> $paged </span><span class="pun">&gt;</span><span class="pln"> </span><span class="hljs-number"><span class="lit">1</span></span><span class="pln"> </span><span class="pun">)</span><span class="pln"> </span><span class="hljs-keyword"><span class="pln">echo</span></span><span class="hljs-string"><span class="str">'&lt;meta name="robots" content="noindex,follow" /&gt;'</span></span><span class="pun">;</span><span class="pln"> </span><span class="hljs-meta"><span class="pun">?&gt;</span></span></span>
<span class="php"><span class="hljs-meta"><span class="pun">&lt;?</span><span class="pln">php</span></span><span class="pln"> </span><span class="pun">}</span><span class="pln"> </span><span class="hljs-meta"><span class="pun">?&gt;</span></span></span>
<span class="php"><span class="hljs-meta"><span class="pun">&lt;?</span><span class="pln">php</span></span>
<span class="hljs-keyword"><span class="kwd">if</span></span><span class="pun">(</span><span class="pln">is_category</span><span class="pun">())</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="hljs-meta"><span class="pun">?&gt;</span></span></span>
<span class="php"><span class="hljs-meta"><span class="pun">&lt;?</span><span class="pln">php</span></span><span class="pln"> $paged </span><span class="pun">=</span><span class="pln"> get_query_var</span><span class="pun">(</span><span class="hljs-string"><span class="str">'paged'</span></span><span class="pun">);</span>
<span class="hljs-keyword"><span class="kwd">if</span></span><span class="pln"> </span><span class="pun">(</span><span class="pln"> $paged </span><span class="pun">&gt;</span><span class="pln"> </span><span class="hljs-number"><span class="lit">1</span></span><span class="pln"> </span><span class="pun">)</span><span class="pln"> </span><span class="hljs-keyword"><span class="pln">echo</span></span><span class="hljs-string"><span class="str">'&lt;meta name="robots" content="noindex,follow" /&gt;'</span></span><span class="pun">;</span><span class="pln"> </span><span class="hljs-meta"><span class="pun">?&gt;</span></span></span>
<span class="php"><span class="hljs-meta"><span class="pun">&lt;?</span><span class="pln">php</span></span><span class="pln"> </span><span class="pun">}</span><span class="pln"> </span><span class="hljs-meta"><span class="pun">?&gt;</span></span></span>
<span class="php"><span class="hljs-meta"><span class="pun">&lt;?</span><span class="pln">php</span></span>
<span class="hljs-keyword"><span class="kwd">if</span></span><span class="pun">(</span><span class="pln">is_tag</span><span class="pun">())</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="hljs-meta"><span class="pun">?&gt;</span></span></span>
<span class="php"><span class="hljs-meta"><span class="pun">&lt;?</span><span class="pln">php</span></span><span class="pln"> $paged </span><span class="pun">=</span><span class="pln"> get_query_var</span><span class="pun">(</span><span class="hljs-string"><span class="str">'paged'</span></span><span class="pun">);</span>
<span class="hljs-keyword"><span class="kwd">if</span></span><span class="pln"> </span><span class="pun">(</span><span class="pln"> $paged </span><span class="pun">&gt;</span><span class="pln"> </span><span class="hljs-number"><span class="lit">1</span></span><span class="pln"> </span><span class="pun">)</span><span class="pln"> </span><span class="hljs-keyword"><span class="pln">echo</span></span><span class="hljs-string"><span class="str">'&lt;meta name="robots" content="noindex,follow" /&gt;'</span></span><span class="pun">;</span><span class="pln"> </span><span class="hljs-meta"><span class="pun">?&gt;</span></span></span>
<span class="php"><span class="hljs-meta"><span class="pun">&lt;?</span><span class="pln">php</span></span><span class="pln"> </span><span class="pun">}</span><span class="hljs-meta"><span class="pun">?&gt;</span></span></span>

 

到这里,通过wordpress新站高度集中权重seo优化的两种方案,便可集中网站权重,防止没有实质性内容被搜索引擎所收录,快来加到你的网站中把。

常见问题FAQ

免费下载或者贵宾会员专享资源能否直接商用?
本站所有资源版权均属于原作者所有,提供资源均只能用于参考学习用,请勿直接商用。若由于商用引起版权纠纷,一切责任均由使用者承担。更多说明请参考 《免责声明》。
点击下载链接不跳转怎么回事?
您好,QQ内打开是不跳转的,一少部分浏览器也不跳转,一般的UC了,搜狗 360等浏览器都可以跳转。
可以直接把资源发给我吗?
您好,付费资源可以直接把链接发送给您,免费资源不提供任何帮助,软件资源自测,或者请站长喝红牛!

发表评论

立即查看