If you find that Google Console is showing lots of errors, that mention “Duplicate without user-selected canonical“, then one of the reasons would be that Google sees the same content for different URL’s. This can be down to Woocommerce pagination. to stop this you need to add no-follow attribute to the actual button that is produced by Woocommerce.
To do this FTP into your site and my URL was /themes/MYTHEME/shop/elements/shop/pagination.php (yours will be slightly different.
Adjust your code to add the “no-follow” link by using the PHP replace function.
This will now make Google ignore following the links that come from the pagination buttons. Whcih in turn will reduce the errors you see in the Google Console.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
<div class="woocommerce-pagination"> <?php $mylinks = paginate_links( apply_filters( 'woocommerce_pagination_args', array( 'base' => $base, 'format' => $format, 'add_args' => false, 'current' => max( 1, $current ), 'total' => $total, 'prev_text' => '←', 'next_text' => '→', 'type' => 'list', 'end_size' => 3, 'mid_size' => 3, ) ) ); $mylinks = str_replace('<a ', '<a rel="nofollow" ', $mylinks); echo $mylinks; ?> </div> |