Okay
  Public Ticket #3810446
SEO: Add meta description to event
Open

Comments

  •  2
    rosewich started the conversation

    Could you add a way to supply a meta description to each event? We think it's not possible to use existing SEO plugins for this as they do not see the events post type. 

  •  924
    Zhivko replied

    Hi,

    The plugin automatically places the event short description as og:description

    If you want to modify something in the og you can check out the file /includes/posts/class.post-stec_event.php line 27.

    There is a filter that you can use to override the default og meta.

    Example:

    add_filter('stec_single_og', function ($og, $post_id) {
       
        $og_meta = '
            <meta property="og:title" content="' . esc_attr(get_the_title($post_id)) . '" />
            <meta property="og:description" content="' . esc_attr(get_the_excerpt($post_id)) . '" />
            <meta property="og:url" content="' . esc_url(get_permalink($post_id)) . '" />
            <meta property="og:image" content="' . esc_url(get_the_post_thumbnail_url($post_id, 'full')) . '" />
            <meta property="og:type" content="website" />
        ';
    
        return $og_meta;
    }, 10, 2);

    If Yoast SEO is enabled the plugin will use teh Yoast SEO og meta instead.

     

     


    Stachethemes Developer

  •  2
    rosewich replied

    Many thanks for the info. 

    I have now noticed that we are not using the field “short description” correctly. We use it to show the names of the organizers within the grid view. The reason for this: the grid view does only display one organizer per event. But we often have events with multiple organizers. – For this reason we are hiding the field with CSS. 

    Would it be possible to update the grid view, that it shows all organizers?

    After that, we would be able to use short description for the SEO description.