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


Thread tagged as: Problem, Blog

Facebook og data not showing on blog posts

I’m trying to set up the Facebook go data on blog posts, I have it working fine on standard pages but I don’t anything at all from the page attributes on blog post pages.

Here is my diagnostic:

Perch: 2.8.13, PHP: 5.6.0, MySQL: 5.6.23, with PDO
Server OS: Linux, litespeed
Installed apps: content (2.8.13), assets (2.8.13), categories (2.8.13), perch_blog (4.6)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_blog', );
PERCH_PATH: /home/helenaclayton/public_html/perch
PERCH_CORE: /home/helenaclayton/public_html/perch/core
PERCH_RESFILEPATH: /home/helenaclayton/public_html/perch/resources
Image manipulation: GD
PHP limits: Max upload 2M, Max POST 8M, Memory: 128M, Total max file upload: 2M
Resource folder writeable: Yes
HTTP_HOST: helenaclayton.co.uk
DOCUMENT_ROOT: /home/helenaclayton/public_html
REQUEST_URI: /perch/core/settings/diagnostics/
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php

I have this in the head of my post page:

        # get the post
        $post = perch_blog_custom(array(
      'filter'        => 'postSlug',
      'match'         => 'eq',
      'value'         => perch_get('s'),
      'skip-template' => 'true',
      'return-html'   => 'true',

        # set up the variables
        $title       = $post['0']['postTitle'];
        $description = strip_tags($post['0']['excerpt']);
        if (isset($post[0]['fbimage'])) {
        $fbimage = $post[0]['fbimage'];
        } else {
        $fbimage = '';

        # use the variables in the array value 
        'description'    => $description,
            'og_description' => $description,
            'og_title'       => $title,
            'og_type'        => 'article',
            'sharing_image'  => $fbimage,
            'og_author'      => 'Helena Clayton',

Nick Bramwell

Nick Bramwell 5 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

What result do you get?

Hello Drew, it doesn’t output anything from the attributes at all, I’ve turned on debugged and there are no errors. On the non-blog pages I used:

        $domain        = 'http://'.$_SERVER["HTTP_HOST"];
        $url           = $domain.$_SERVER["REQUEST_URI"];
        $sitename      = "Helena Clayton";
        $twittername   = "@helenaclayton";
        $sharing_image = '/images/for_facebook.jpg';


            'template' => 'default.html'    

which works fine.

Both use the same template.

Drew McLellan

Drew McLellan 2638 points
Perch Support

We've just released Blog 5.0 to make this simpler. It has a dedicated section for entering Facebook and Twitter meta data, and a simple function to output it all in the head of your page.

Blog: https://grabaperch.com/add-ons/apps/blog

New page function: https://docs.grabaperch.com/addons/blog/page-functions/perch-blog-post-meta/