I've been stuck on this problem for a few days, so I thought its best to ask the community.
So my problem is this, I'm trying to share a post. The post is generated dynamically. I'm using the addthis.com sharing toolbox. I also installed the SEO plugin by netsti and added the component on header
Now when I want to share, the image doesn't load on first share. I need to scrape the information through Facebook debugger.
I want to know if there is anyway to make a
So I'd like to know if there's anyway to set up the meta og image on head with functions like onStart or onEnd
Thanks
Yes why not you can add your own tags in layouts.
In your layout files or partial files where your <head>
tag is, you can define something like this
{% if fbImage %}
<meta property="og:image" content="{{ fbImage }}" />
{% endif %}
Now in your page code section, you can define onStart method and add your fbImage
function onStart(){
// or you can get file object from your post or record
// and get its absolute path and use it `getPath()`
$imagePath = 'https://yoursite/image.jpeg';
$this['fbImage'] = $imagePath; // image absolute path
}
In this way you are telling page what image to display in "og:image" tag and for security we are checking its value if its not defined or blank we used if condition so "og:image" tag will not added.
If any issue please comment.