What is the order of priority of image previews for discourse links on twitter?

I know that when you post a link to your forum on Twitter, and if the linked post contains a Image or more, the preview of the thread on Twitter will show that image or the first image in the thread as the thumbnail for the preview.

I have also read that there are “categories images” which can be shown as the thumbnail, and also there is a “twitter summary large image” option in the site settings, however I have never been able to see any of these latter two at work as thumbnails on twitter, because if there is no image in the body of the forum post itself, the thumbnail I get is just the default gray image with an icon in the center, to the felt pf the text preview.

So, how can I control which image is displayed as the topic thumbnail on Twitter?

Your help will be much appreciated.

ps: twitter api keys are stored and twitter login is working.

1 Like

Hello,

There are several settings for this.

  1. opengraph image
  2. twitter summary large image
  3. category logo image
  4. post first image

The opengraph image is the base. If you only set up this then it will appear if there is no post or category image.

If you set up a twitter summary large image then it will override the opengraph image on Twitter. So it will appear on Twitter instead of opengraph image.

The category logo image and post first image always take priority over the others.


Priority order:

  1. post first image and category logo image
    (if missing) :arrow_down_small:

  2. twitter summary large image
    (if missing) :arrow_down_small:

  3. opengraph image
    (if missing) :arrow_down_small:

  4. large icon

(if I am right)


Configure

The opengraph image and twitter summary large image you can set up here: /admin/site_settings/category/branding


For the category logo image go to the specific category settings Images tab.


Tests on Twitter

I share a post link which has no contain image and with twitter summary large image setting :arrow_down_small:

Screenshot 2022-12-01 at 10.24.55

I share a post link which contain image and with twitter summary large image setting :arrow_down_small:

Screenshot 2022-12-01 at 10.26.55

I share a post link which not contain image and no twitter summary large image but I seted up an opengraph image

Screenshot 2022-12-01 at 10.30.08

I share a category link which contains category logo image

Screenshot 2022-12-01 at 12.02.51

Share site link without opengraph image and other setting.
Screenshot 2022-12-01 at 10.34.03


Hope this helps :slightly_smiling_face:

3 Likes

So, I am struggling with this. I have two posts that behave differently and I can’t figure out why. One post shows the onebox preview image in twitter. The other shows the twitter_summary_large _image.

This post works as expected.
https://community.abs-consulting.com/t/welcome-to-issue-65-of-the-abs-devops-scm-e-newsletter/22

This post does not work as expected.
https://community.abs-consulting.com/t/devsecops-platforms-help-smbs-scale-as-they-grow/113

Welcome robert :wave: :slight_smile:

I see regular oneboxes for both:


Yes. That piece works. But it when it is shared to social networks I get different behavior.

Screenshot 2023-02-14 at 11.47.22 AM

Screenshot 2023-02-14 at 11.48.47 AM

1 Like

Each website has its own way to select the image that will be used as a thumbnail when displaying a preview.

Usually, a meta tag specifies an image and it’s the first choice.

Your link doesn’t have such tags, and thus various websites will pick an image from the page HTML based on their own criteria.

I don’t know how Discourse specifically chooses which image to use. It may even build a composite image from various HTML parts. :person_shrugging:

1 Like

Ok, that makes sense. But I would expect the two post to behave the same. Unless discourse or twitter is somehow parsing the link onebox has presented and then looking for the meta tag from there and not from the discourse post? That might explain why the first post may link to a webpage that has defined meta-tag where the second post that inbox is referencing does not.

Are you saying here that the Discourse post does not have the ‘meta-tag’ or the link that onebox is referencing does not have the ‘meta-tag’?

I’m talking about this. The page you share should have the proper meta tags that will be used on most platforms (twitter, facebook, discord, discourse, etc etc). :slight_smile:

I thinks this is a good resource to learn about this:

Looks like I was able to resolve the issue. I had to change the setting, Files >> download remote images to local. This is now enabled. I tested by disabling creating a topic. Reenable, create a duplicate topic. Next I checked the thumbnail image in both topics. One is referencing the local image store. The other is referencing the remote image from the link.

Next I sharing each topic to a social network, linked-in cause the preview works. In the case with the local image store. The LinkedIn preview picks-up the local image from my community. The other gives serves the opengraph_image from settings and not the thumbnail image from the link site.

So, it appears I need to have the setting, Files >> download remote images to local, enabled to show the preview image from onebox propagated to the social network when sharing links.