I have an image field in my blog that I'd like to use as the og:image and use the summary description that's truncated for the og:description field.
What do I need to set on my page template <head> and what do I need to set on my CGBlog detail template? Any guidance would be appreciated.
This is currently the custom field I have for the image I'd like to use for the OG:Image.
{$entry->file_location}/{$entry->fieldsbyname.870x300->value}
Thank you for your time.
CGBlog and OG Tags
Re: CGBlog and OG Tags
In CGBlog you need to assign it to a variable with global scope, so something like:
Then in your master page template head:
You can also set a default instead of testing for it, so:
Code: Select all
{if $entry->fieldsbyname.870x300}
{$ogimage="{$entry->file_location}/{$entry->fieldsbyname.870x300->value}" scope=global}
{/if}
Code: Select all
{if $ogimage}
<meta property="og:image" content="{$ogimage}" />
{/if}
Code: Select all
<meta property="og:image" content="{$ogimage|default:'url/image.jpg'}" />
Not getting the answer you need? CMSMS support options
Re: CGBlog and OG Tags
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Re: CGBlog and OG Tags
Thank you, I was struggling a bit with the cgblog templates and the primary templates. This helps immensely, I was doing the same thing (I thought) but it wasn't working so I will try with your example.