• 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)),'', '/' ));
    • This topic was modified 7 months, 1 week ago by edanwp.
    • This topic was modified 7 months, 1 week ago by edanwp.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter edanwp

    (@edanwp)

    My previous fix in em-calendar.php was wrong, it should be:

    $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)), '/' ));

    How can I get the developer’s attention to apply the fixes? It’s frustrating to see the number of wasted requests crawlers are doing because of it.

    [20/Jun/2024:17:11:27 +0000] "GET /57105/?id=276971852&ajaxCalendar=1&mo=11&yr=2024 HTTP/2.0" 200 27482 "-" "facebookexternalhit/1.1 (+https://www.facebook.com/externalhit_uatext.php)"
    ?
    [20/Jun/2024:17:11:27 +0000] "GET /category/test/page/5/?id=827964334&ajaxCalendar=1&mo=6&yr=2024 HTTP/2.0" 200 29844 "-" "facebookexternalhit/1.1 (+https://www.facebook.com/externalhit_uatext.php)"

    Maybe can completely remove the “href” since it’s all done JS anyway.

    Plugin Author Marcus

    (@msykes)

    We need to evaluate this a little more closely, but essentially I agree with your ideas.

    We’re also going tor emove the id= querystring because that’s unique each page load and we can add it on via JS, that’ll help immediately and will be out in today’s update.

    Additionally, we’re adding a calendar_nav_nofollow parameter you can add to your shortcode. We’ll elaborate further on this in a following release, but you can also make that a default value set to try by hooking into the em_calendar_get_default_search filter, the array key is in there.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.