为 API 帖子添加图片

你只需添加图片的网址,无需任何 html img 标签

https://unsplash.com/photos/JoZazcPhW5Y

像这样

然后 discourse 会自动生成一个链接预览。但这甚至不是一个指向图片的链接,它只是一个指向 unsplash.com 网站上某个页面的链接。你需要使用图片的实际链接:

https://images.unsplash.com/photo-1658603458978-4a32b8cdadb7?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=3272&q=80

如果你正在使用 api,你可以在帖子的 ‘raw’ 字段中包含图片网址。