Woocommerce Noindex特定类别分页页面

Woocommerce Noindex特定类别分页页面,woocommerce,pagination,noindex,Woocommerce,Pagination,Noindex,WooCommerce正在为父类别创建类别分页页面。我们不希望这些被编入索引,但我不知道如何最好地做到这一点 比如我有 这将上升到第31页,但我只希望主类别页面索引,而不是这些分页页面。这不是一个网站范围的要求,我仍然希望其他页面的分页索引,所以我不能作出全球性的改变 我已经看了以下内容 <meta name="robots" content="follow, <?php echo (get_query_var('paged')==1)?'index':'noindex'?>

WooCommerce正在为父类别创建类别分页页面。我们不希望这些被编入索引,但我不知道如何最好地做到这一点

比如我有

这将上升到第31页,但我只希望主类别页面索引,而不是这些分页页面。这不是一个网站范围的要求,我仍然希望其他页面的分页索引,所以我不能作出全球性的改变

我已经看了以下内容

<meta name="robots" content="follow, <?php echo 
(get_query_var('paged')==1)?'index':'noindex'?>" /><meta name="robots" 
content="follow, <?php echo (get_query_var('paged')==1)?'index':'noindex'? 
>" />

我使用了多合一SEO API来解决这个问题,如下所示

 add_filter( 'aioseop_robots_meta', 'change_robots_meta_value' );

 function change_robots_meta_value( $robots_meta_value ) {
 if( is_product_category( 'PYO' ) && is_paged() ) {
      $robots_meta_value = 'noindex,nofollow';
 }
if( is_product_category( 'Light Engines' ) && is_paged() ) {
      $robots_meta_value = 'noindex,nofollow';
 }
    if( is_product_category( 'LED Count' ) && is_paged() ) {
      $robots_meta_value = 'noindex,nofollow';
 }
        if( is_product_category( 'Micromoles' ) && is_paged() ) {
      $robots_meta_value = 'noindex,nofollow';
 }
            if( is_product_category( 'Size' ) && is_paged() ) {
      $robots_meta_value = 'noindex,nofollow';
 }
                if( is_product_category( 'Wavelength' ) && is_paged() ) {
      $robots_meta_value = 'noindex,nofollow';
 }
                    if( is_product_category( 'Thermal' ) && is_paged() ) {
      $robots_meta_value = 'noindex,nofollow';
 }
 return $robots_meta_value;
}
 add_filter( 'aioseop_robots_meta', 'change_robots_meta_value' );

 function change_robots_meta_value( $robots_meta_value ) {
 if( is_product_category( 'PYO' ) && is_paged() ) {
      $robots_meta_value = 'noindex,nofollow';
 }
if( is_product_category( 'Light Engines' ) && is_paged() ) {
      $robots_meta_value = 'noindex,nofollow';
 }
    if( is_product_category( 'LED Count' ) && is_paged() ) {
      $robots_meta_value = 'noindex,nofollow';
 }
        if( is_product_category( 'Micromoles' ) && is_paged() ) {
      $robots_meta_value = 'noindex,nofollow';
 }
            if( is_product_category( 'Size' ) && is_paged() ) {
      $robots_meta_value = 'noindex,nofollow';
 }
                if( is_product_category( 'Wavelength' ) && is_paged() ) {
      $robots_meta_value = 'noindex,nofollow';
 }
                    if( is_product_category( 'Thermal' ) && is_paged() ) {
      $robots_meta_value = 'noindex,nofollow';
 }
 return $robots_meta_value;
}