Home › Forums › Calendar Products › Events Calendar PRO › Nofollow on events, organizers and venues
- This topic has 11 replies, 4 voices, and was last updated 9 years, 8 months ago by
Omar.
-
AuthorPosts
-
July 14, 2016 at 5:40 am #1139580
Omar
ParticipantHello!
I need to set nofollow links on the events calendar on events, organizers and venues.
I’ve tried it with the solution posted about setting nofollow on outgoing links to event organizer websites, but the code won’t work for internal nofollows.
Do you have a solution for me?
Best regards
July 14, 2016 at 2:23 pm #1139933Nico
MemberHi there Omar,
Thanks for reaching out to us on this! I’ll help you getting this done ๐
Iโve tried it with the solution posted about setting nofollow on outgoing links to event organizer websites, but the code wonโt work for internal nofollows.
Can you please point me to this solution?
Also, Can you please specify in which screens you want to achieve this? It might need various template overrides if you want to do this for all single event links across the calendar (check more details in the themer’s guide).
Please let me know about it,
Best,
NicoJuly 14, 2016 at 11:44 pm #1140176Omar
ParticipantHey Nico,
Thanks for your quick response.
Sure, i’ve tried the solution presented in this thread:
add_filter( 'tribe_get_event_website_link', 'add_no_follow_event_website', 10, 2); function add_no_follow_event_website( $html ) { //Strip out HTML $url = strip_tags( $html ); //Add nofollow attribute return sprintf( '<a href="%1$s" rel="nofollow" target="_self">%1$s</a>', $url ); }I’ve tried to add a filter to :
‘tribe_get_venue_website_link’
‘tribe_get_day_link’
‘tribe_get_organizer_link’but unfortunately it didn’t work out.
Basically the following structure or the following links should be made nofollow:
/venue/specific_venue
/organizer/specific_organizer
/events/2016-xx-xx
/event/specific_name_of_eventBest regards
July 15, 2016 at 11:07 am #1140462Nico
MemberThanks for clarifying Omar!
The snippet you are using is actually working for me, but please note this in not the event link, but the external website link for the event: https://cloudup.com/cuGY79A63RP
Regarding the other filters you mention, it looks like it should work for tribe_get_venue_website_link and tribe_get_organizer_link because as tribe_get_event_website_link, the functions are returning the link html element, while in the case of single events it’s only returning the URL for the event and the markup for the link is inside the template (and there are a bunch of templates to modify).
If you don’t want the single pages for events, venues and organizer and day view, then it might be a better idea to print a robots meta tag with ‘noindex, nofollow’? Please let me know if this would work, if not I can see if there’s a hacky solution that might work for you.
Have a great weekend,
NicoJuly 17, 2016 at 11:37 pm #1140944Omar
ParticipantHey,
Thanks for your quick reponse.
Yes the snippet is working for the filters you’ve mentioned, unfortunately it’s not the filters which I need to work.
I just need the links to the single organizer, single event and a specific venue to be nofollow.
If you could afford me with a hacky solution that would be awesome.
Regarding the robots I don’t know if it would work, as I’m not so experienced in writing robots.txt .
Thanks and best regards!
July 18, 2016 at 6:45 am #1141004Nico
MemberThanks for the follow-up Omar!
Can yo please let me know what’s the goal of this customization? If you don’t want the single event, single organizer and single venue pages to be indexed by search engines, then it’s a better practice (and simpler to implement in this case) to add a meta tag in the head of the html that indicates search engines not to crawl the page. I’m not talking about adding a robots.txt just the tag in the html head.
Please let me know about it,
Best,
NicoJuly 19, 2016 at 8:07 am #1141469Omar
ParticipantHey!
Goal of this customization would be to only index the main page of all events / organizers / venues, as a specific event will expire and customers on google can still search for it and will find it already taken place. The same is for venues and organizers.
The meta tag should be a good plan in the html, so there are two options as I see:
– nofollow on link outgoing from the list of all events / organizers …
– noindex on specific pageAs for implementation I would think, that adding the noindex on specific events is way more simple.
Best regards
July 20, 2016 at 3:02 pm #1142174Nico
MemberThanks for following up Omar!
Please try pasting this snippet in your theme (or child theme) functions.php file:
/* Tribe add noindex meta to single pages for event, venues & organizers */
function tribe_noindex ( ) {global $wp_query;
if ( empty( $wp_query->tribe_is_event_query ) ) {
return;
}$event_display = get_query_var( 'eventDisplay' );
$add_noindex = ( ! $wp_query->have_posts() || 'month' === $event_display || 'single-event' === $event_display || tribe_is_event_venue() || tribe_is_event_organizer() );
return $add_noindex;
}
add_filter ( 'tribe_events_add_no_index_meta', 'tribe_noindex' );
This should add the <meta name="robots" content="noindex,follow" /> tag in the single pages for events, venues and organizers.
Please give the snippet a try and let me know about it,
Best,
NicoJuly 21, 2016 at 2:39 am #1142324Omar
ParticipantHey Nico,
Thanks for your response. As I will be on vacation till Monday I can give you a feedback to the solution on Monday.
Much thanks for your effort.Best regards
July 21, 2016 at 8:27 am #1142419Nico
MemberThanks for the heads-up Omar! Enjoy your time out ๐
August 12, 2016 at 9:35 am #1150998Support Droid
KeymasterThis topic has not been active for quite some time and will now be closed.
If you still need assistance please simply open a new topic (linking to this one if necessary)
and one of the team will be only too happy to help. -
AuthorPosts
- The topic ‘Nofollow on events, organizers and venues’ is closed to new replies.
