# \[付费\] 自动将 Discourse 主题（论坛）转换为 Google AMP

**URL:** <https://meta.discourse.org/t/paid-convert-discourse-topics-forum-to-google-amp-automatically/155244>\
**Category:** Marketplace\
**Created:** [2020年六月18日 16:16 UTC](https://meta.discourse.org/t/paid-convert-discourse-topics-forum-to-google-amp-automatically/155244 "2020-06-18T16:16:36Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Faizan\_Zahid](https://avatars.discourse-cdn.com/v4/letter/f/b9bd4f/32.png) [@Faizan\_Zahid](https://meta.discourse.org/u/Faizan_Zahid)\
**Post date:** [2020年六月18日 16:16 UTC](https://meta.discourse.org/t/paid-convert-discourse-topics-forum-to-google-amp-automatically/155244/1 "2020-06-18T16:16:36Z")

</div>

您希望完成什么工作？

我想自动将我所有的 Discourse 论坛主题页面（包括整个论坛及首页）转换为 Google AMP。

您或他人是否已通过插件实现过此功能？

如果没有，我很乐意付费委托开发。请告诉我，您也可以通过站内信联系我。

该解决方案必须完全遵循 AMP 最佳实践（[AMP - a web component framework to easily create user-first web experiences](https://amp-dev.cdn.ampproject.org/v/s/amp.dev/?amp_js_v=a2&amp_gsa=1&usqp=mq331AQFKAGwASA%3D#aoh=15924979196851&referrer=https%3A%2F%2Fwww.google.com&amp_tf=From%20%251%24s&ampshare=https%3A%2F%2Famp.dev%2F%EF%BC%89%EF%BC%8C%E5%B9%B6%E5%85%BC%E5%AE%B9%E6%9C%AA%E6%9D%A5%E6%89%80%E6%9C%89%E7%9A%84) Discourse 更新和主题更新。

您希望何时完成？

越快越好。

您能为此任务提供的预算（美元）是多少？

我接受各种报价，请告知您的想法。

---

<div class="post-metadata">

**Author:** ![fzngagan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fzngagan/32/259349_2.png) [@fzngagan](https://meta.discourse.org/u/fzngagan)\
**Post date:** [2020年七月2日 20:54 UTC](https://meta.discourse.org/t/paid-convert-discourse-topics-forum-to-google-amp-automatically/155244/3 "2020-07-02T20:54:26Z")

</div>

这里有一篇相关文章可供阅读。

> [@Discourse Comment Embed to Support Google AMP?](https://meta.discourse.org/t/discourse-comment-embed-to-support-google-amp/64721/7):
>
> AMP friendly in this case likely means a server side javascripts/embed.js such that a script does not need to be pasted into the body of the target page and appended to the head. The current functionality is very dependent on client side processes. For example, it would solve the problem if I could include a \<iframe src="discourseurl/embed-comments?embed\_url=myurl"\>\</iframe\> I got pretty close to this functionality, but none of the links work and I am bypassing your validation. I did read th…

其次，如果通过插件实现，这将涉及对模板的大规模覆盖。如果这里有 AMP 方面的专家，我很想了解更多关于 Discourse AMP 的信息。可行性目前尚存疑问。作为一个 AMP 新手，我的建议是尽可能通过插件市场逐步推进。

---

<div class="post-metadata">

**Author:** ![Faizan\_Zahid](https://avatars.discourse-cdn.com/v4/letter/f/b9bd4f/32.png) [@Faizan\_Zahid](https://meta.discourse.org/u/Faizan_Zahid)\
**Post date:** [2020年七月4日 05:46 UTC](https://meta.discourse.org/t/paid-convert-discourse-topics-forum-to-google-amp-automatically/155244/4 "2020-07-04T05:46:17Z")

</div>

@fzngagan 感谢您的回复。我查阅了与 Metadiscourse 相关的 AMP 主题，确实看到很多人对此很感兴趣。是否有可能创建一个主题页面的 AMP 版本，并将其作为文件托管在我的网站上？

然后，我可以在 Discourse 的 HTML 主题模板中添加一行代码，以显示该页面的 AMP 版本位置。

例如，这行代码将被添加到当前的 Discourse 主题 HTML 页面中：

```
<link rel="amphtml" href="https://www.example.com/url/to/amp/document.html">

```

而这行代码将被添加到 AMP 页面中：

```
<link rel="canonical" href="https://www.example.com/url/to/full/document.html">

```

来源：[Make your pages discoverable](https://amp.dev/documentation/guides-and-tutorials/optimize-and-measure/discovery/?referrer=ampproject.org)

但我该如何以及在哪里托管这个 AMP 文件，以便能从我的网站提供它？

Discourse 团队或应用市场中是否有人可以为我完成这项工作？因为我对 Discourse 的模板工作机制以及如何托管主题页面的 AMP 版本还不够熟悉。这需要是一个文件，并且需要放置在我的网站的某个位置。

我们可以创建一个新的 AMP 文件，并通过 Discourse API 传入主题名称和 ID，动态填充该主题的内容，获取其帖子并插入到页面的 AMP 版本中。但我应该在我的 Discourse 论坛中哪里托管这个自定义的 AMP 文件呢？我是在自己的网站上独立运行 Discourse，而不是在子域名上运行。

有人能帮我解决这个问题吗？我愿意为此付费。[@staff](https://meta.discourse.org/groups/staff) [@team](https://meta.discourse.org/groups/team) 我应该标记哪些人，以便让这个话题能被真正能帮忙的相关人员看到？

---

<div class="post-metadata">

**Author:** ![eduardogoncalves](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eduardogoncalves/32/187607_2.png) [@eduardogoncalves](https://meta.discourse.org/u/eduardogoncalves)\
**Post date:** [2020年七月14日 19:17 UTC](https://meta.discourse.org/t/paid-convert-discourse-topics-forum-to-google-amp-automatically/155244/5 "2020-07-14T19:17:42Z")

</div>

你好 @Faizan_Zahid，我建议只转换问答页面，以便它们能被 Google/AMP 缓存索引。这样，当用户从 AMP 缓存版本访问时，该 AMP 页面会预加载你现有的 PWA。随后，当用户点击链接跳转到其他页面时，你的 PWA 就会接管。

---

<div class="post-metadata">

**Author:** ![Faizan\_Zahid](https://avatars.discourse-cdn.com/v4/letter/f/b9bd4f/32.png) [@Faizan\_Zahid](https://meta.discourse.org/u/Faizan_Zahid)\
**Post date:** [2020年七月20日 12:09 UTC](https://meta.discourse.org/t/paid-convert-discourse-topics-forum-to-google-amp-automatically/155244/6 "2020-07-20T12:09:51Z")

</div>

@eduardogoncalves 谢谢，但我仍然没有找到支持我的 Discourse 话题页面启用 AMP 并提供话题页面 AMP 替代版本的方法。我仍在寻找能将其作为付费项目或付费插件为我实现的人。

---

<div class="post-metadata">

**Author:** ![eduardogoncalves](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eduardogoncalves/32/187607_2.png) [@eduardogoncalves](https://meta.discourse.org/u/eduardogoncalves)\
**Post date:** [2020年七月20日 19:41 UTC](https://meta.discourse.org/t/paid-convert-discourse-topics-forum-to-google-amp-automatically/155244/7 "2020-07-20T19:41:21Z")

</div>

你好 🙂

我将下载 Discourse 的 Docker 镜像并进行测试，看看能否提供帮助。

我认为我们有两个选择：

- 尝试将 Ember.js 的输出解析为兼容 AMP 的格式
- 或者从头开始为 AMP 页面创建新模板。

有人能确认一下当 JavaScript 被禁用时加载的版本是否是 [discourse/app/views/topics at main · discourse/discourse · GitHub](https://github.com/discourse/discourse/tree/master/app/views/topics) 中的那个吗？

 ![image](https://global.discourse-cdn.com/meta/original/3X/d/b/dbc6e5c8180ce193e3714cdbedf5b8d26198e8ed.png)

---

<div class="post-metadata">

**Author:** ![Faizan\_Zahid](https://avatars.discourse-cdn.com/v4/letter/f/b9bd4f/32.png) [@Faizan\_Zahid](https://meta.discourse.org/u/Faizan_Zahid)\
**Post date:** [2020年七月20日 19:49 UTC](https://meta.discourse.org/t/paid-convert-discourse-topics-forum-to-google-amp-automatically/155244/8 "2020-07-20T19:49:17Z")

</div>

@eduardogoncalves 非常感谢您终于主动尝试为话题页面支持 AMP。也许 @pfaffman 或 @angus 中的某位可以回答您的问题。 🙂

该视图似乎包含用于 Google 结构化数据的文件。我认为您可以将通用的 AMP 支持的话题布局页面放在上面，并通过 Discourse API 动态填充话题标题、元内容、帖子等信息。

另外，有人知道如何在我的 Discourse 话题（尤其是问题类话题）上启用 Google 结构化数据功能，以便 Google 能像其他问答网站那样以精美的摘要形式展示它们吗？

---

<div class="post-metadata">

**Author:** ![eduardogoncalves](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eduardogoncalves/32/187607_2.png) [@eduardogoncalves](https://meta.discourse.org/u/eduardogoncalves)\
**Post date:** [2020年七月30日 13:24 UTC](https://meta.discourse.org/t/paid-convert-discourse-topics-forum-to-google-amp-automatically/155244/9 "2020-07-30T13:24:55Z")

</div>

你好，抱歉回复晚了……最近几周工作非常繁忙。

正如我在 LinkedIn 聊天中告诉 Faizan 的那样，我没有 Discourse 和 Ruby 的使用经验。  
请问有人能指点我如何在 URL 末尾添加 “/amp” 并加载自定义模板文件吗？例如：“[https://meta.discourse.org/t/paid-convert-discourse-topics-forum-to-google-amp-automatically/155244/7/amp](https://meta.discourse.org/t/paid-convert-discourse-topics-forum-to-google-amp-automatically/155244/7/amp)”。

---

<div class="post-metadata">

**Author:** ![Faizan\_Zahid](https://avatars.discourse-cdn.com/v4/letter/f/b9bd4f/32.png) [@Faizan\_Zahid](https://meta.discourse.org/u/Faizan_Zahid)\
**Post date:** [2020年七月30日 21:27 UTC](https://meta.discourse.org/t/paid-convert-discourse-topics-forum-to-google-amp-automatically/155244/10 "2020-07-30T21:27:44Z")

</div>

@eduardogoncalves 请查看 [Creating Routes in Discourse and Showing Data - #19](https://meta.discourse.org/t/creating-routes-in-discourse-and-showing-data/48827/19?u=pfaffman%EF%BC%8C%E8%BF%99%E4%BC%9A%E5%AF%B9%E4%BD%A0%E6%9C%89%E6%89%80%E5%B8%AE%E5%8A%A9%E3%80%82)

感谢 @pfaffman 提供的帮助。

---

<div class="post-metadata">

**Author:** ![eduardogoncalves](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eduardogoncalves/32/187607_2.png) [@eduardogoncalves](https://meta.discourse.org/u/eduardogoncalves)\
**Post date:** [2020年七月30日 21:55 UTC](https://meta.discourse.org/t/paid-convert-discourse-topics-forum-to-google-amp-automatically/155244/11 "2020-07-30T21:55:12Z")

</div>

看起来它不起作用。

[https://meta.discourse.org/t/creating-routes-in-discourse-and-showing-data/48827/21?u=eduardogoncalves](https://meta.discourse.org/t/creating-routes-in-discourse-and-showing-data/48827/21?u=eduardogoncalves)

[https://meta.discourse.org/t/creating-routes-in-discourse-and-showing-data/48827/22?u=eduardogoncalves](https://meta.discourse.org/t/creating-routes-in-discourse-and-showing-data/48827/22?u=eduardogoncalves)

---

<div class="post-metadata">

**Author:** ![justin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/justin/32/157614_2.png) [@justin](https://meta.discourse.org/u/justin)\
**Post date:** [2020年七月30日 22:01 UTC](https://meta.discourse.org/t/paid-convert-discourse-topics-forum-to-google-amp-automatically/155244/12 "2020-07-30T22:01:23Z")

</div>

你好，只是想确认一下——这是否仍是一个开放的职位，还是关于实施 AMP 的讨论？如果是后者，我很乐意转到 #Dev 频道。如果仍是开放职位，请将讨论内容限制在此范围内。

非常感谢！

---

<div class="post-metadata">

**Author:** ![Faizan\_Zahid](https://avatars.discourse-cdn.com/v4/letter/f/b9bd4f/32.png) [@Faizan\_Zahid](https://meta.discourse.org/u/Faizan_Zahid)\
**Post date:** [2020年八月4日 11:13 UTC](https://meta.discourse.org/t/paid-convert-discourse-topics-forum-to-google-amp-automatically/155244/13 "2020-08-04T11:13:58Z")

</div>

这是一个开放职位，我们正在寻找能够将其作为付费项目完成的人（在 Discourse 的所有页面上支持 AMP）。如果您认识合适的人选或可以推荐，请通过 [faizan.zad@gmail.com](mailto:faizan.zad@gmail.com) 联系 @justin。

非常感谢。

---

<div class="post-metadata">

**Author:** ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)\
**Post date:** [2020年九月3日 11:14 UTC](https://meta.discourse.org/t/paid-convert-discourse-topics-forum-to-google-amp-automatically/155244/14 "2020-09-03T11:14:02Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
