WooCommerce is creating category pagination pages for parent categories. We don't want these indexed, but I can't work out how best to do this.
For instance I have https://www.i-hled.co.uk/product-category/light-engines/led-count-one/page/2/
This goes up to page 31, but I only want the main category page indexed not these paginated pages. This is NOT a site wide requirement, I still want other pages pagination to index, so I can't make a global change.
I've looked at the following
<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'?
>" />
But that removes all pagination indexing
Also I thought of something along these lines in the header, but I can't work out how this would work with pagination.
if ( is_product_category(led-count-one){
echo "<meta name=\"robots\" content=\"noindex\" />";
}
Is there a way to do this in htaccess file instead? Or is code in the header.php file the best option?
https://www.i-hled.co.uk/product-category/light-engines/led-count-one/page/2/ https://www.i-hled.co.uk/product-category/light-engines/led-count-one/page/3/ etc
Will not be indexed, but https://www.i-hled.co.uk/product-category/light-engines/led-count-one/one-led/page/2/ https://www.i-hled.co.uk/product-category/light-engines/led-count-one/one-led/page/3/ etc
Will be indexed