# Set the image used for social network sharing?

**URL:** <https://meta.discourse.org/t/set-the-image-used-for-social-network-sharing/107880>\
**Category:** Support\
**Created:** [January 30, 2019, 5:22am UTC](https://meta.discourse.org/t/set-the-image-used-for-social-network-sharing/107880 "2019-01-30T05:22:57Z")\
**Posts on this page:** 11\
**Page:** 2

<div class="post-metadata">

**Author:** ![EGreg](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/egreg/32/133614_2.png) [@EGreg](https://meta.discourse.org/u/EGreg)\
**Post date:** [January 30, 2019, 10:10pm UTC](https://meta.discourse.org/t/set-the-image-used-for-social-network-sharing/107880/21 "2019-01-30T22:10:02Z")

</div>

Yes this is a great fallback.

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)\
**Post date:** [January 30, 2019, 11:59pm UTC](https://meta.discourse.org/t/set-the-image-used-for-social-network-sharing/107880/22 "2019-01-30T23:59:36Z")

</div>

Also apologies I forgot we added that other per-category social media share image setting. I kinda blacked that out due to trauma over the earlier discussion 🤕

---

<div class="post-metadata">

**Author:** ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)\
**Post date:** [January 31, 2019, 5:23am UTC](https://meta.discourse.org/t/set-the-image-used-for-social-network-sharing/107880/23 "2019-01-31T05:23:37Z")

</div>

> [@codinghorror](#):
>
> when no image exists in the first post, go ahead and use the site logo

When working on adding this feature I caught a bug. I noticed that right now here is how we prioritize OpenGraph image: `first post image > opengraph_image > twitter_summary_large_image_url > site_apple_touch_icon_url`.

And [https://discourse.codinghorror.com](https://discourse.codinghorror.com) did had the `site_apple_touch_icon_url` so the `twitter:image` tag was present `<meta name="twitter:image" content="/images/default-apple-touch-icon.png" />`.

Turns out Twitter [does not support relative image paths](https://stackoverflow.com/a/45941439). This is now fixed via:

[https://github.com/discourse/discourse/commit/f83533e1cb5ff262cb25d9392bc2dcc1621fb0ab](https://github.com/discourse/discourse/commit/f83533e1cb5ff262cb25d9392bc2dcc1621fb0ab)

Above commit also adds `logo_url` as last resort for OpenGraph/Twitter image tag. This updates opengraph image priority to: `first post image > opengraph_image > twitter_summary_large_image_url > site_apple_touch_icon_url > logo_url`.

Verified the fix on [https://discourse.codinghorror.com](https://discourse.codinghorror.com):

 ![ch](https://global.discourse-cdn.com/meta/original/3X/e/c/ec9171aa9c428bc673de59a893b617ac11dd3731.png)

---

<div class="post-metadata">

**Author:** ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)\
**Post date:** [January 31, 2019, 10:52am UTC](https://meta.discourse.org/t/set-the-image-used-for-social-network-sharing/107880/24 "2019-01-31T10:52:51Z")

</div>

> [@techAPJ](#):
>
> first post image \> opengraph\_image \> twitter\_summary\_large\_image\_url \> site\_apple\_touch\_icon\_url \> logo\_url

When set, the `large_icon` may be preferable than `site_apple_touch_icon_ur` because it’s larger. Also we did bug everyone to set it already.

---

<div class="post-metadata">

**Author:** ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)\
**Post date:** [January 31, 2019, 7:50pm UTC](https://meta.discourse.org/t/set-the-image-used-for-social-network-sharing/107880/25 "2019-01-31T19:50:43Z")

</div>

I added the `large_icon` as fallback. The new priority is: `first post image > opengraph_image > twitter_summary_large_image_url > site_large_icon_url > site_apple_touch_icon_url > site_logo_url` .

[REFACTOR: Simplify finding the opengraph image · discourse/discourse@ec7f418 · GitHub](https://github.com/discourse/discourse/commit/ec7f418a22188bcdf7749c8bb75d8d3ddc2927b0)

This also removes the warning that has been flooding the logs.

> `SiteSetting.logo_url` has been deprecated and will be removed in the 2.4 Release. Please use `SiteSetting.logo` instead

---

<div class="post-metadata">

**Author:** ![jord8on](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jord8on/32/166809_2.png) [@jord8on](https://meta.discourse.org/u/jord8on)\
**Post date:** [March 10, 2020, 2:41pm UTC](https://meta.discourse.org/t/set-the-image-used-for-social-network-sharing/107880/26 "2020-03-10T14:41:58Z")

</div>

Many of the posts in our community may contain several images.

Is there a way to tag an image or define, for a specific topic, which image to use for opengraph and social sharing?

Also, the [Topic List Previews](https://meta.discourse.org/t/topic-list-previews/101646) (by @merefield and @angus) plugin takes the first image in a post and uses that for the thumbnail or tile image. I’m wondering if there’s a way to tell the plugin to use the 2nd, or 3rd, or 8th image, etc.

* * *

btw @codinghorror, I got to test out that [Better Insert Hyperlink](https://meta.discourse.org/t/discourse-2-4-released/142862) feature from the 2.4 release, above, to find **Topic List Previews** plugin discussion, and right here with this hyperlink. Snazzy new feature!! 🙌

---

<div class="post-metadata">

**Author:** ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)\
**Post date:** [March 10, 2020, 2:45pm UTC](https://meta.discourse.org/t/set-the-image-used-for-social-network-sharing/107880/27 "2020-03-10T14:45:04Z")

</div>

> [@jord8on](#):
>
> I’m wondering if there’s a way to tell the plugin to use the 2nd, or 3rd, or 8th image, etc.

That’s already in the plugin. I added a thumbnail picker last year 🙂 (btw, I’ve not considered how that might impact social sharing, feel free to experiment!).

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)\
**Post date:** [March 10, 2020, 6:12pm UTC](https://meta.discourse.org/t/set-the-image-used-for-social-network-sharing/107880/28 "2020-03-10T18:12:43Z")

</div>

> [@jord8on](#):
>
> Is there a way to tag an image or define, for a specific topic, which image to use for opengraph and social sharing?

Yes – the first big image is the one that is used. So make sure the most important image is first (and large enough, tiny images won’t work).

---

<div class="post-metadata">

**Author:** ![jord8on](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jord8on/32/166809_2.png) [@jord8on](https://meta.discourse.org/u/jord8on)\
**Post date:** [March 10, 2020, 6:46pm UTC](https://meta.discourse.org/t/set-the-image-used-for-social-network-sharing/107880/29 "2020-03-10T18:46:08Z")

</div>

@merefield and @codinghorror - I can confirm that using the [Topic List Previews](https://meta.discourse.org/t/topic-list-previews/101646) tool not only allows you to select which image you would like to use as the featured image for your thumbnails but when doing so, that image you select will also become the image that appears for opengraph and social sharing, instead of the default setting of displaying the first image in the post!

Here’s an example where I’ve chose to use the 8th image with the “Select Thumbnail” feature and here’s how the post now appears when sharing (and on my “Latest” topics page):

> **[Pickleball made a huge dent in my life... Here's the story](https://forums.pickleballist.com/t/pickleball-made-a-huge-dent-in-my-life-heres-the-story/130)**
>
> Okay, it’s storytime! I’m going to take you back to day 1… it’s relevant… trust me! 😜 But before I start, let me share a sad truth… I didn’t pick up my first pickleball paddle until I was 38 years old! Pretty sad sounding life, I know. But… after...

Here’s how to select a thumbnail image, using the [Topic List Preview plugin](https://meta.discourse.org/t/topic-list-previews/101646)…

 ![2020-03-10_12-39-18 (1)](https://global.discourse-cdn.com/meta/original/3X/3/6/36567707b2caeb503222901e013a2d86be90163b.gif)

---

<div class="post-metadata">

**Author:** ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)\
**Post date:** [October 28, 2022, 8:09am UTC](https://meta.discourse.org/t/set-the-image-used-for-social-network-sharing/107880/30 "2022-10-28T08:09:06Z")

</div>

For the record: Discourse Core has the ability to do this since [February 2021](https://github.com/discourse/discourse/commit/830797a9c3f82f66c882c0e33f9fa08551db0af2). We may look at making it more discoverable in future, but for now you can manually edit the markdown of the image and set one as the thumbnail.

By default Discourse will use the first image in the OP of the topic. If you would like to select a different image from the OP, add `|thumbnail` to the markdown. For example

```plaintext
![alttext|100x100](upload://aaa)
![alttext|100x100|thumbnail](upload://bbb) << this one will be the thumbnail

```

(this was originally discussed over in the official [Topic List Thumbnails](https://meta.discourse.org/t/topic-list-thumbnails/150602) topic, but this core thumbnail selection feature isn’t specific to that theme component)

---

<div class="post-metadata">

**Author:** ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)\
**Post date:** [October 31, 2022, 8:00am UTC](https://meta.discourse.org/t/set-the-image-used-for-social-network-sharing/107880/31 "2022-10-31T08:00:25Z")

</div>

This topic was automatically closed after 2 days. New replies are no longer allowed.

[Previous page](https://meta.discourse.org/t/set-the-image-used-for-social-network-sharing/107880.md?page=1)
