Widget URLs are relative to their display page & are crawled by Google
-
I’ve noticed my website has thousands of pages in google console that are related to the events’ widget next & previous URLs. Although Google doesn’t index them, it still crawls them, which is a complete waste of resources.
When a user press them, it changes inline, but when Google sees the URLs, it follows it.
I suggest 2 fixes:
In /templates/calendar/section-header-navigation.php, add “rel=nofollow” when creating the links:
<a class="em-calnav em-calnav-prev" href="<?php echo esc_url($calendar['links']['previous_url']); ?>" data-disabled="<?php echo empty($calendar['links']['previous_url']) ? 1 : 0; ?>" rel="nofollow"> <a href="<?php echo esc_url($calendar['links']['today_url']); ?>" class="em-calnav-today button button-secondary size-large size-medium <?php if( date('Y-m') === $EM_DateTime->format('Y-m') ) echo 'is-today'; ?>" rel="nofollow"> <a class="em-calnav em-calnav-next" href="<?php echo esc_url($calendar['links']['next_url']); ?>" data-disabled="<?php echo empty($calendar['links']['next_url']) ? 1 : 0; ?>" rel="nofollow">
In /classes/em-calendar.php, make the links relative to / instead of the local page to prevent creating unlimited new URLs (for search engines that ignore “rel=nofollow”)
$next_url = esc_url_raw(add_query_arg( array_merge($link_args, array('mo'=>$month_next, 'yr'=>$year_next)),'', '/' )); $calendar_array['links']['today_url'] = esc_url_raw(add_query_arg( array_merge($link_args, array('mo'=>$today->format('m'), 'yr'=>$today->format('Y'))),'', '/' )); $calendar_array['links']['previous_url'] = esc_url_raw(add_query_arg( array_merge($link_args, array('mo'=>$month_last, 'yr'=>$year_last)),'', '/' ));
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.