Blog - Meta and Social tab "Image when shared"

  • In the a blog post, under the Meta and Social tab, there is an option for "Image when shared".

    I uploaded a different image that I want to be used when the blog post is shared.

    But when I share the url in a facebook or linkedin post, it's pulling the original image.


    Any ideas of why it's doing this? Do I need to change a setting somewhere?

  • drewm

    Approved the thread.
  • No it doesn't. I just pasted my code below.

    Where would I add an OG tag and what is it?


    <body>

    <?php perch_content('Navigation'); ?>

    <div class=body_text_center>

    <div class="col2of3">

    <?php perch_blog_post($post_slug); ?>

    <div class="meta">

    <?php perch_blog_post_categories($post_slug); ?>

    </div>

    <div class="tags">

    <?php perch_blog_post_tags($post_slug); ?>

    </div>

    <div class="clear"></div>

    <!-- Go to www.addthis.com/dashboard to customize your tools -->

    <h3>Share</h3>

    <div class="addthis_inline_share_toolbox"></div>

    <?php perch_blog_post_comments($post_slug); ?>

    <?php perch_blog_post_comment_form($post_slug); ?>

    </div>

    <div class="col-3 border-left sidebar">

    <?php perch_blog_categories(); ?>

    </div>

    <div class="big-clear"></div>

    </div>

    <?php perch_content('footer'); ?>

    </body>

  • Hi Drew,


    Thanks for your help and sorry if I'm missing the obvious.

    The sample website on github doesn't have og tags.


    I found 2 files in the templates post_meta and meta_head.

    They both have og tags inside.

    I am not sure how to add them to the file.

    I've tried a few different ways (linking them or directly pasting) and its not working.


    Do you have a writeup on how to use the og tags? Or can you point me in the direction of someone I can hire to help?

    I'm at my wits end here.


    Thanks!

  • Hi Design,

    here’s how I have done it:

    In your page (e.g. “project.php”), after including Perch‘s runtime.php and before including the header, tell Perch what image to use.

    Then in your header.php set the meta tag for og:image with that image:

    PHP
    1. <meta property="og:image" content="<?php print PerchSystem::get_var('ogimage', true); ?>" />
  • Hello Design,


    I would use the following in my top layout to output the blog meta template when in a blog post:


    PHP
    1. <?php
    2. if (perch_layout_has('blog-post')) {
    3. perch_blog_post_meta(perch_get('s'));
    4. } else {
    5. perch_page_attributes();
    6. }
    7. ?>


    Hope this helps.


    Mike