# 不为所有博客文章自动生成主题

**URL:** https://meta.discourse.org/t/not-generate-topic-automatically-for-all-blog-posts/146678
**Category:** Support
**Created:** [2020年四月3日 09:37 UTC](https://meta.discourse.org/t/not-generate-topic-automatically-for-all-blog-posts/146678 "2020-04-03T09:37:54Z")
**Posts on this page:** 1
**Showing post:** 11

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [2020年四月7日 18:02 UTC](https://meta.discourse.org/t/not-generate-topic-automatically-for-all-blog-posts/146678/11 "2020-04-07T18:02:51Z")

</div>

> [@nianiaJR](#):
>
> 如何通过 API 设置“不公开”？

弄清楚这一点最简单的方法是：按照本指南中概述的步骤，在 Discourse 用户界面中尝试取消公开某个主题，然后再将其恢复公开：[如何逆向工程 Discourse API](https://meta.discourse.org/t/how-to-reverse-engineer-the-discourse-api/20576)。

要通过 API 自动化该过程，您需要设置一个 Webhook 来监听帖子事件。当收到 Webhook 通知您嵌入分类中的首篇帖子已创建时，即可发送 API 请求将该主题设置为“不公开”。当收到 Webhook 通知您某主题的第二篇帖子已创建时，再发送 API 请求将该主题恢复为“公开”。

如上所述，更好的做法可能是：当用户首次从博客站点点击链接进入该主题时，自动将其设置为“不公开”。这样，第一位发表评论的用户就不会看到该主题被标记为“不公开”。虽然这样设置会稍微复杂一些，但可以通过 API 实现：监听指向您 Discourse 主题的链接上的点击事件即可完成。

---

_[View the full topic](https://meta.discourse.org/t/not-generate-topic-automatically-for-all-blog-posts/146678)._
