设置用于社交媒体分享的图片?

Yes this is a great fallback.

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 :face_with_head_bandage:

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 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. This is now fixed via:

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:

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.

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

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

我们社区中的许多帖子可能包含多张图片。

有没有办法为图片添加标签,或者针对特定主题定义用于 Open Graph 和社交分享的图片?

另外,Topic List Previews(由 @merefield@angus 开发)插件会提取帖子中的第一张图片作为缩略图或网格图片。我想知道是否有办法让该插件使用第二张、第三张、第八张等图片。


顺便提一下,@codinghorror,我刚才测试了 2.4 版本中推出的 Better Insert Hyperlink 功能,用它找到了 Topic List Previews 插件的讨论,并且就在这个超链接中。这个新功能真棒!!:raising_hands:

[quote=“jord8on, 帖子:26, 主题:107880”]
我想知道是否有办法让插件使用第 2 张、第 3 张、第 8 张等图片。[/quote]

插件中已经包含此功能。我去年添加了缩略图选择器 :slight_smile: (顺便提一下,我尚未考虑这会对社交分享产生何种影响,欢迎自行尝试!)

有的——使用的第一张大图就是被选中的图片。因此,请确保最重要的图片排在第一位(并且尺寸足够大,过小的图片将无法生效)。

@merefield@codinghorror - 我可以确认,使用 主题列表预览 工具,您不仅可以选择要用作缩略图特色图片的图像,而且当您进行选择时,所选图像还将成为 Open Graph 和社交分享时显示的图像,而不是默认显示帖子中第一张图片的设置!

这是一个示例,我选择使用“选择缩略图”功能中的第 8 张图片,以下是帖子在分享时(以及在我的“最新”主题页面上)的显示效果:
https://forums.pickleballist.com/t/pickleball-made-a-huge-dent-in-my-life-heres-the-story/130

以下是如何使用 主题列表预览插件 选择缩略图图像的方法…

供记录:Discourse Core 自 2021 年 2 月起就具备了此功能。我们可能会在未来考虑使其更易于发现,但目前您可以手动编辑图片的 markdown 并将其设置为缩略图。

默认情况下,Discourse 将使用主题 OP 中的第一张图片。如果您想从 OP 中选择另一张图片,请在 markdown 中添加 |thumbnail。例如:

![alttext|100x100](upload://aaa)
![alttext|100x100|thumbnail](upload://bbb) << 这张将是缩略图

(这最初是在官方的 Topic List Thumbnails 主题中讨论的,但此核心缩略图选择功能并非此主题组件特有)