# 是否有办法获得已发布的帖子，但又不显示 onebox？

**URL:** <https://meta.discourse.org/t/is-there-a-route-to-get-a-cooked-post-but-without-rendered-oneboxes/167157>\
**Category:** Product Support\
**Created:** [2020 年10 月 14 日 08:10 UTC](https://meta.discourse.org/t/is-there-a-route-to-get-a-cooked-post-but-without-rendered-oneboxes/167157 "2020-10-14T08:10:07Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

作者： ![Terrapop](https://avatars.discourse-cdn.com/v4/letter/t/ecd19e/32.png) [@Terrapop](https://meta.discourse.org/u/Terrapop)\
发布日期： [2020 年10 月 21 日 10:35 UTC](https://meta.discourse.org/t/is-there-a-route-to-get-a-cooked-post-but-without-rendered-oneboxes/167157/9 "2020-10-21T10:35:12Z")

</div>

这正是问题所在。由于已渲染的帖子中包含“单框”（oneboxes，它们不再包含原始媒体链接，只有原始帖子才保留原始链接），我们无法将其转换为符合 Facebook Instant Articles (IA) 有效格式的文档。

Iframely 能够从独立链接生成符合 IA 标准的 iframe。我们曾尝试使用原始帖子，配合 PHP 的 Markdown 解析器（Markdown-It for PHP）以及 Iframely 来处理独立链接，但 Discourse 的 Markdown 解析过程要复杂得多，而我们并不希望重新实现 Discourse 对 Markdown 所执行的所有“魔法”处理。因此，我们正在寻找一种方案：获取已渲染的帖子，但其中不包含已解析的单框（因为我们希望随后通过 Iframely 对这些单框进行后处理）。

我们目前的方法适用于简单帖子：即以原始帖子为基础，使用 PHP 的 Markdown-It 将其转换为 HTML，再利用 Iframely 生成符合 IA 标准的媒体卡片（单框不符合该标准），然后将 HTML 转换为 Facebook IA 所需的 HTML 格式，并通过 Facebook PHP SDK 进行传输。然而，由于 Discourse 在 Markdown 解析过程中应用了大量额外规则，如果我们能直接从 Discourse 获取已解析的 HTML，同时排除其中的单框，那将理想得多。

---

_[View the full topic](https://meta.discourse.org/t/is-there-a-route-to-get-a-cooked-post-but-without-rendered-oneboxes/167157)._
