I need to add an image in open graph image meta tag in head section on a blog page. Can somebody how I can achieve this.

protected function _prepareLayout()
        $post = $this->getPost();
        $this->pageConfig->addBodyClass('blog-post-' . $post->getIdentifier());
        ?><head><meta property="og:image" content="https://turner-sports.co.uk/pub/media/blog/punch_bag_blog_featured_image_1.png" /></head><?php

        return parent::_prepareLayout();

1 Answer 1


Your extension already have og:image tag option. Goto below file location:


Check the below condition:

<?php if ($image = $block->getImage()) { ?>
<meta property="og:image" content="<?php echo $block->escapeHtml($image); ?>" />
<?php } ?>

If you have image then only this tag will render. Check it and add your image then it will show.

UPDATED ANSWER: Update your module to latest version. You can find out the latest version:


Also you need to install


which is dependent module of blog extension.

  • Currently i cant see opengraph.phtml in module.But i am adding it with above code you sent to me. ibb.co/jEfZx9
    – Anees
    Sep 13, 2018 at 8:46
  • Check my updated answer. I think you are using old version, you need to update your module. Sep 13, 2018 at 9:00
  • Thanks A Lot buddy i am updating to new version.Hopefully it solve the issue.
    – Anees
    Sep 13, 2018 at 9:04
  • Welcome. If its working for you then tick the green mark near the answer . Sep 13, 2018 at 9:05
  • Yes problem Solved
    – Anees
    Sep 13, 2018 at 16:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.