Support

Home Forums Event Espresso Premium Venue and start date in URL – SEO

Venue and start date in URL – SEO

Posted: July 1, 2015 at 4:35 am


Gregor

July 1, 2015 at 4:35 am

Hi
I’m using SEO Yoast and i would like to have following:
– url of event should have (SEO reasons) a venue and possible starting date
– there are some tags that we can use to create SEO title. What to use to show venue in Event Title (SEO)?

Thank you


Dean

July 1, 2015 at 6:34 am

Hi,

In EE4, events and venues are post types, so they follow the same URL structure as a standard Post or Page.

You can, for instance, edit the Permalink in the event/venue editor and add in the appropriate information.

Alternatively you could simply add the venue/date to the event title when creating the event and this will be incorporated into the the permalink.

It isn’t possible to insert venues and dates into the page title via the Titles & Metas > Post Types section in WordPress SEO.

Instead you would need to get creative and use the various filters that the WordPress SEO plugin provides: https://yoast.com/wordpress/plugins/seo/api/

As a very basic example:

function wpseo_title_change( $string ) {

  global $post;

  //get the venues associated with this event.
  $ven = $post->EE_Event->venues();

  //loop through them (even though there is only one).
  foreach ($ven as $venue) {
    //add the venue name after the SEO title with a dash
    $string = $string . ' - ' . $venue->name();
  }

  return $string;

}

add_filter( 'wpseo_title', 'wpseo_title_change', 10, 1 );

The above is just an example and should not be used on a production site. It will however be a good starting point for your own/your developers work.

We have some developer related documentation here that may assist:
http://code.eventespresso.com/


Gregor

July 1, 2015 at 7:23 am

Hi Dean

Thank you for reply. I’ll stick to Venue in title .. should have come up with this idea by myself 🙂

Thank you

The support post ‘Venue and start date in URL – SEO’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso