Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRM-21639 NOINDEX Event Info page when event is non-public or in the past #11496

Merged

Conversation

magnolia61
Copy link
Contributor

@magnolia61 magnolia61 commented Jan 9, 2018

Overview

This patch makes sure the Event Info page gets the NOINDEX metatag in order for Search Engines to NOT index the page when the event is either in the past or non-public.

Before

Even when an event was closed (past event) or non-public it would still be indexed by google and other search engines.

After

With this patch the Event Info and the corresponding Map page page gets the NOINDEX,NOFOLLOW metatag

Technical Details

The NOINDEX,NOFOLLOW gets inserted into head when either the event is:

  1. non-public
    2. past events

Comments

This patch will not remove old event page info listings from google, but a ligitimate site owner can remove them using the Google Search Console. With the NOINDEX tag in place they will not be reindexed.


@magnolia61 magnolia61 changed the title CRM-21639 NOINDEX Event Info page when event is non-public CRM-21639 NOINDEX Event Info page when event is non-public, non-active or closed Jan 9, 2018
@eileenmcnaughton
Copy link
Contributor

@colemanw what do you think about this? I think it should go in a function ie. SetNoIndex - but perhaps you have some ideas about a generic approach?

@magnolia61
Copy link
Contributor Author

magnolia61 commented Jan 9, 2018

just for reference: I also submit this PR on (no)indexing of the Print Preview pages #11498

@mlutfy
Copy link
Member

mlutfy commented Jan 10, 2018

I'm not sure I agree that the event should be NOINDEX when the event is closed? It could still be a useful information that people might want to search for?

Also, the event registration might be closed, but the event date could be in the future. People will have a harder time trying to find information about the event if they cannot find it through google? (I'm that kind of person who may have registered for an event, it might be somewhere in my email, but I will google it anyway.. plus the Info page might have updated information)

edit: "When Googlebot next crawls that page and see the tag or header, Googlebot will drop that page entirely from Google Search results, regardless of whether other sites link to it." ref

@magnolia61
Copy link
Contributor Author

Hi Mathieu, good point. I changed the PR to only use NOINDEX for

  1. non-public events
  2. past events
    I think this would be more in line with the use case you describe. Agree?

@magnolia61 magnolia61 changed the title CRM-21639 NOINDEX Event Info page when event is non-public, non-active or closed CRM-21639 NOINDEX Event Info page when event is non-public or in the past Jan 10, 2018
@magnolia61
Copy link
Contributor Author

I just added the location mapping because I believe this should also respect the non-public setting and exclude past events for being indexed by google.

$startDate = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $ids, 'start_date');
$is_public = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $ids, 'is_public');
if ($is_public == 0 OR $startDate < $today) {
CRM_Utils_System::addHTMLHead('<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we create a function addNoFollowHead or similar - I feel like we might get a situation where the preferrred meta for no-follow changes & it would be good to only change in one place.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for this idea. Grepping shows there are 4 other spots in the codebase already containing this line, so refactoring them into a function makes sense.

@eileenmcnaughton
Copy link
Contributor

regarding past events - based on end date makes more sense I think. A course that has started but not ended might make sense to index (I'm a bit torn on doing this in core rather than an extension TBH - I feel like not public is clear cut but the past events feels like there could be use cases that differ. However, if they are past the end date it's probably ok - although I still search for past civicons :-)

@colemanw
Copy link
Member

I agree with most people here that past events should be indexed but private events should not.

@magnolia61 magnolia61 force-pushed the CRM-21639-NoIndex_when_event_is_not_public branch from 8cd2235 to c6d4092 Compare February 15, 2018 10:10
@magnolia61
Copy link
Contributor Author

I can live with that, I adjusted the commit and merged into one.
Each admin can manually or by a query set past events to non-pulic.
Good to go now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants