Jump to content

Replace Sharer Image on Profile Pages


TimTheMiles

Recommended Posts

Posted

Hello IPS, 

So I'm looking to change something for that's been bothering for quite some time.
But I don't know how to go about it. My goal is to replace the Sharer Image that shows by default on Profiles.
When you share a profile link to Facebook, Twitter, or any other platform. It automatically uses the Sharer Image instead of the Profile Picture.

Is there a way to force it to grab the Profile Picture instead?
Maybe some snippet of Code I can add to my theme?

Posted
27 minutes ago, opentype said:

{{if $member->photo}}
{{\IPS\Output::i()->metaTags['og:image'] = $member->photo;}}
{{endif}}

somewhere in the profileHeader template.

 

OK I added it to the ProfileHeader Template.
And then I tested it on Discord and Twitter, but nothing right now.
How long do you think it will take before it starts showing?

Posted

I tested your site. It is working correctly on Facebook for uncached or re-scraped profiles with an image. Twitter is rejecting to create Twitter cards since you have other meta tag errors. That is unrelated to the og:image though. 

Posted

Note that Facebook has minimum dimension requirements for sharer images, so if any profile image is too small it won't work (or rather, FB likely won't honor the profile image as the sharer image).

Archived

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

  • Recently Browsing   0 members

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