angus
(Angus McLeod)
2023 年6 月 9 日 09:38
5
感谢 @Canapin 。
@anon48433008 这种情况有几种可能,因为 WP Discourse 插件会进行一些小的 HTML 解析,然后 Discourse 也会进行 HTML 解析和重新抓取。链接被剥离最有可能发生在 Discourse 的 HTML 解析和重新抓取过程中,即 Discourse 处理帖子中嵌入的 HTML 的方式。例如,请参阅:
For example, I inserted a Youtube video inline in a WP post that got pushed to Discourse as a topic. When people click the “Show full post…” button, for some reason the Youtube video doesn’t come through. (I’m only guessing this is true for all embeds. Perhaps it’s a Youtube-specific problem?)
或者
Thanks for explaining Kevin. There are no settings specifically directed at this issue, but there’s two ways you could approach this.
Customize what HTML is pulled from your site
The way embeds work is that they scrape the content from a site using the Readability gem. The gem and it’s output use the following options to filter what HTML is scraped
opts[:whitelist] = SiteSetting.allowed_embed_selectors if SiteSetting.allowed_embed_selectors.present?
opts[:blacklist] = SiteSetting.blocked_embe…
我的具体建议是,与其寻求“技术”修复,不如将链接与图片分开,例如在图片下方使用链接。我理解您希望将它们保持在一起,但在这方面,您将面临一场艰苦的战斗才能使其始终如一地工作。将它们分开可能会奏效。
本质上,Discourse 不追求导入帖子的 HTML 保真度。它追求的是讨论内容的保真度。您的 Wordpress 到 Discourse 的策略应考虑到这一点,这意味着您希望您的用户在 Wordpress 上阅读帖子,而 Discourse 上的版本仅作为讨论的参考。
2 个赞