CGBlog and OG Tags

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Locked
rbaby
Forum Members
Forum Members
Posts: 144
Joined: Thu Feb 07, 2008 10:28 pm

CGBlog and OG Tags

Post by rbaby »

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.
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1629
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: CGBlog and OG Tags

Post by DIGI3 »

In CGBlog you need to assign it to a variable with global scope, so something like:

Code: Select all

{if $entry->fieldsbyname.870x300}
{$ogimage="{$entry->file_location}/{$entry->fieldsbyname.870x300->value}" scope=global}
{/if}
Then in your master page template head:

Code: Select all

{if $ogimage}
<meta property="og:image" content="{$ogimage}" />
{/if}
You can also set a default instead of testing for it, so:

Code: Select all

<meta property="og:image" content="{$ogimage|default:'url/image.jpg'}" />
Not getting the answer you need? CMSMS support options
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

Re: CGBlog and OG Tags

Post by Rolf »

- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
rbaby
Forum Members
Forum Members
Posts: 144
Joined: Thu Feb 07, 2008 10:28 pm

Re: CGBlog and OG Tags

Post by rbaby »

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.
Locked

Return to “Modules/Add-Ons”