-
Hi RankMath,
I’m experiencing an issue on a WooCommerce site of mine using RankMath.
My site uses YITH WooCommerce Ajax Product Filters and I have recently discovered that my search console is filled with Excluded by ‘noindex’ tag URLs with no canonical.
With the standard WooCommerce filters, RankMath or WooCommerce sets a Canonical URL for either /shop/ or /category/ or /tag/.
This implementation is perfect as per Googles Guidelines etc.
YITH recommended this filter code to exclude these pages. However, this isn’t an ideal solution as it still sees these pages crawled a lot, especially in a store with a huge number of filters. No to mention it doesn’t pass Link Juice etc.
if( ! function_exists( 'yith_wcan_robots' ) ){
function yith_wcan_robots( $robots ){
if( ! empty( $_GET['yith_wcan'] ) ){
$robots['index'] = 'noindex';
$robots['follow'] = 'nofollow';
}
return $robots;
}
add_filter( 'rank_math/frontend/robots', 'yith_wcan_robots' );
}
When you look at the filtered pages’ HTML source, there is no Canonical Tag set. However, <meta property=”og:url” is set to the Canonical URL.
So my question is could the RankMath Filter to change the Canonical URL be used to set the Canonical on these pages?
If, so could you adapt the above code to support that function?
Thanks,
Regan
The ticket ‘YITH WooCommerce Ajax Product Filter Canonical URLs Issue’ is closed to new replies.