Jump to content

Pages: Image sharer with external link

Featured Replies

Posted

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.

  • Author

bump

  • Author

..

  • Community Expert

There are no settings or very simple code changes to achieve this.

Of course you are free to hire a developer to write a plugin to override the default og:image with your external images. 

Edited by opentype

  • Author

Thanks mate, I remember that this was possible in previous IPB versions.

It seems I'll have to upload the images directly >_<

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}}

 

Edited by jeece76

  • Community Expert

That’s great!

I just used this to add Twitter Card meta tags to my articles, so sharing the articles will now look much more appealing on Twitter. ^_^

 

Edited by opentype

  • Author
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?

  • Community Expert

The record template used for the specific Pages database.

Archived

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

Recently Browsing 0

  • No registered users viewing this page.