We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum

Forum

Thread tagged as: Question, Meta, Blog

Open Graph meta data

Hi, first time user of Perch and I've successfully built and launched fulmart.co.uk using it as a CMS. I'm struggling with the open graph meta data being used when a blog article URL is posted into Facebook. Ideally I'd like to set the data in the Meta and Social section of the blog CMS and for this data to be used when the article is published. Is there a simple walk-through guide on how to do this? I've pasted:

<?php
    if (perch_layout_has('blog-post')) {
        perch_blog_post_meta(perch_get('s'));
    }else{
        echo '<title>' . perch_pages_title(true) . '</title>';
    }
?>

into the head of post.php which outputs as <title>Post</title> in the HTML code. Pretty stuck. Any help greatly appreciated.

Chris Jones

Chris Jones 0 points

  • 1 year ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Have you updated the blog/meta_head.html template?

https://docs.grabaperch.com/functions/blog/perch-blog-post-meta/

Hussein Al Hammad

Hussein Al Hammad 105 points
Registered Developer

Looking at one of the blog posts on the website, it looks like you have multiple <title> tags in <head>. Weirdly none of them has the post title. Can you show us how you are outputting the <head>?

Thanks for your comments and apologies if my questions sound dumb but this is all new to me.

I've removed the static <title> tag and replaced with <?php perch_blog_post_meta(perch_get('s')); ?> on the post detail page and it is now outputting the blog post title as the page <title> tag - great!

Just checked the source code and the og details appear to be displaying correctly in the post head.

Thank you.