OG:IMAGE for Archive page

Home Forums Calendar Products Events Calendar PRO OG:IMAGE for Archive page

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1327342
    Scott Gillard
    Participant

    Now that Facebook does not allow changes to the graph-generated link previews it is essential that I find a way to add og:title, description, and image meta data to the events archive page. Otherwise I am unable to share the events list on Facebook.

    Is there anywhere in the theme templates that I could place the meta data so it gets pulled correctly?

    #1328461
    Cliff
    Member

    Hi, Scott.

    If you’re not using a plugin like Yoast SEO that does this for you, you could do something like this:

    https://gist.github.com/cliffordp/b8055fc5cfd9d9bf9298c93e3d84090c

    Of course, customizing it for your own needs.

    Please let me know if you have any follow-up questions on this topic.

    #1331563
    Scott Gillard
    Participant

    Yoast SEO doesn’t actually do this. It allows the addition of a generic image for use on all pages “without other images” but there’s no way to add an “events” featured image to the events archive page.

    I did find the following snippet which seemed to work:

    add_action( 'wp_head', 'prefix_add_og_image', 10, 1 );
    function prefix_add_og_image( $img ) {
        if( is_post_type_archive( 'tribe_events' ) ) {
    	    echo '<meta property="og:image" content="http://hughmackay.ca/wp-content/uploads/2017/08/HMMLA-FBEvents.jpg" />';
        }
    }

    What are your thoughts on this?

    #1331951
    Cliff
    Member

    Thanks for your detailed answer!

    It looks good to me. Does it seem to work for your purposes?

    #1341871
    Support Droid
    Keymaster

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘OG:IMAGE for Archive page’ is closed to new replies.