Jump to content

Pages: Image sharer with external link


Heosforo

Recommended Posts

Hello.

I'm using Pages, but instead of the "Record Image" field, I use an external image for each article.
The problem comes when I share the link on facebook, the image doesn't appear.

Is there any way to make this work? My external images are from imgur.com

Appreciate any help.

Link to comment
Share on other sites

You can do this by adding this code at the top of your template :

{{if ( $record->customFieldDisplayByKey('your_field_name') )}}
{{\IPS\Output::i()->metaTags['og:image'] = (string) \IPS\File::get( 'cms_Records', $record->customFieldDisplayByKey('your_field_name') )->url;}}
{{endif}}

 

Link to comment
Share on other sites

On 26-03-2016 at 5:00 AM, jeece76 said:

You can do this by adding this code at the top of your template :


{{if ( $record->customFieldDisplayByKey('your_field_name') )}}
{{\IPS\Output::i()->metaTags['og:image'] = (string) \IPS\File::get( 'cms_Records', $record->customFieldDisplayByKey('your_field_name') )->url;}}
{{endif}}

 

Hello, thanks for your help.
Please could you tell me where to edit?, globalTemplate, record, or which template?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...