# 页面发布

**URL:** https://meta.discourse.org/t/page-publishing/151971
**Category:** Site Management
**Tags:** how-to, page-publishing, content
**Created:** [2020年五月19日 18:56 UTC](https://meta.discourse.org/t/page-publishing/151971 "2020-05-19T18:56:39Z")
**Posts on this page:** 20
**Page:** 3

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [2023年二月8日 08:47 UTC](https://meta.discourse.org/t/page-publishing/151971/150 "2023-02-08T08:47:34Z")

</div>

> [@Canapin](#):
>
> 你是不是忘了发你的图片？除非你页面的“之后”版本只是音乐 😄

哎呀；我的广告拦截器不知何故阻止了你的第二张图片，真奇怪。

想看这些页面实时效果的人可以看这里：

\u003chttps://noobish.me/t/open-source-culture-no-tags/525\u003e -\u003e \u003chttps://noobish.me/t/open-source-culture-with-tags/320\u003e

真不错。

---

<div class="post-metadata">

### Author: ![lisandro\_iaffar](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lisandro_iaffar/32/315816_2.png) [@lisandro\_iaffar](https://meta.discourse.org/u/lisandro_iaffar)
#### Post date: [2023年二月9日 17:19 UTC](https://meta.discourse.org/t/page-publishing/151971/151 "2023-02-09T17:19:20Z")

</div>

这太棒了！！！感谢分享！！！🤩  
这值得拥有一个单独的“操作指南”条目 👌

---

<div class="post-metadata">

### Author: ![hellekin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hellekin/32/51636_2.png) [@hellekin](https://meta.discourse.org/u/hellekin)
#### Post date: [2023年三月6日 17:55 UTC](https://meta.discourse.org/t/page-publishing/151971/153 "2023-03-06T17:55:44Z")

</div>

使用 CSS “移除”内容的一个明显缺点是，它实际上并没有被移除，只是被隐藏了。因此，您加载了客户端不会使用的数据。

我下面这个问题的意图是确定 Discourse 实践者的一种\_通用\_方法，以\_识别\_跨实例进行讨论的途径。

> [@hellekin](#):
>
> 从已发布的页面链接回原始帖子是否有首选方式？

---

<div class="post-metadata">

### Author: ![denvergeeks](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/denvergeeks/32/327671_2.png) [@denvergeeks](https://meta.discourse.org/u/denvergeeks)
#### Post date: [2023年三月12日 21:32 UTC](https://meta.discourse.org/t/page-publishing/151971/154 "2023-03-12T21:32:05Z")

</div>

**@hellekin “_跨实例_” 指的是什么？**

**您在使用 Wordpress 吗？**

> **[GitHub - discourse/wp-discourse: WordPress plugin that lets you use Discourse as...](https://github.com/discourse/wp-discourse)**
>
> WordPress plugin that lets you use Discourse as the community engine for a WordPress blog

**……还是 Ghost？**

> **[Official Ghost + Discourse Integration](https://ghost.org/integrations/discourse/)**
>
> Setting up Discourse with Ghost allows you to embed comment on your posts and pages & link your site to your community forum. Find out how 👉

**现在有了与 Ghost 和 Discourse 更紧密的集成，支持单点登录……**

> **[✨ Introducing Discourse on Ghost - Reimagining the integration!](https://forum.ghost.org/t/introducing-discourse-on-ghost-reimagining-the-integration/36844)**
>
> 🚀 I’m thrilled to announce Discourse on Ghost - a powerful (open source) tool that allows you to create a seamless and engaging community experience on your Ghost Publication! Discourse has rich discussion capabilities that allow you to create a...

**还有这个插件……**

> [@DiscPage: a plugin to create static pages and insert discussion balloons in the text](https://meta.discourse.org/t/discpage-a-plugin-to-create-static-pages-and-insert-discussion-balloons-in-the-text/136841):
>
> warning Deprecated This plugin is no longer maintained and does not work with current versions of Discourse. We recommend removing it from production sites to avoid upgrade issues. Thank you to everyone who used and contributed to this plugin over the years. folded_hands With DiscPage, you create static pages by adding the “Page” category to any topic. You can then insert balloon icons, to allow users to discuss subsections of the page. See [the old demo](http://www.docuss.org/t/discpage-demo/209) [the new demo](https://www.castafiore.org/t/discpage-demo/79) and [the …](https://github.com/sylque/discpage)

---

<div class="post-metadata">

### Author: ![hellekin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hellekin/32/51636_2.png) [@hellekin](https://meta.discourse.org/u/hellekin)
#### Post date: [2023年三月13日 07:34 UTC](https://meta.discourse.org/t/page-publishing/151971/155 "2023-03-13T07:34:43Z")

</div>

> [@denvergeeks](#):
>
> @hellekin “_跨实例_”是指什么？

指 Discourse 的跨实例。

---

<div class="post-metadata">

### Author: ![Danielle\_Tully](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/danielle_tully/32/294419_2.png) [@Danielle\_Tully](https://meta.discourse.org/u/Danielle_Tully)
#### Post date: [2023年四月20日 16:55 UTC](https://meta.discourse.org/t/page-publishing/151971/156 "2023-04-20T16:55:12Z")

</div>

您好，我目前有一个 discourse 站点，需要登录才能查看和进行任何操作。我想使用“发布主题”功能为用户创建主页，但由于我也在使用安全媒体，因此遇到了以下错误。有什么办法可以解决吗？我尝试了 procourse-static-pages（不适用于最新版本的 discourse，我无法保存新页面。安全组下拉框未被填充，这可能是问题所在）和 discpage（似乎不适用于我正在使用的主题）插件。所以我真的希望这个功能能够奏效。有人有什么建议吗？

 ![image](https://global.discourse-cdn.com/meta/original/4X/c/3/1/c318e2aa38955eaa0894ebd3bd932189dbd548c2.png)

---

<div class="post-metadata">

### Author: ![brasofilo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/brasofilo/32/107087_2.png) [@brasofilo](https://meta.discourse.org/u/brasofilo)
#### Post date: [2023年五月10日 03:34 UTC](https://meta.discourse.org/t/page-publishing/151971/157 "2023-05-10T03:34:05Z")

</div>

哇！  
您对 Discourse 所做的调整真是太棒了，恭喜您并感谢您的分享 🙂  
💓

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [2023年五月10日 04:33 UTC](https://meta.discourse.org/t/page-publishing/151971/158 "2023-05-10T04:33:43Z")

</div>

这很酷。做得好，谢谢分享 👍

---

<div class="post-metadata">

### Author: ![denvergeeks](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/denvergeeks/32/327671_2.png) [@denvergeeks](https://meta.discourse.org/u/denvergeeks)
#### Post date: [2023年五月10日 04:40 UTC](https://meta.discourse.org/t/page-publishing/151971/159 "2023-05-10T04:40:28Z")

</div>

感谢 @brasofilo 和 @Lilly！我正计划基于此及相关用例创建一些主题组件。

---

<div class="post-metadata">

### Author: ![Wall-E](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/wall-e/32/184438_2.png) [@Wall-E](https://meta.discourse.org/u/Wall-E)
#### Post date: [2023年六月8日 00:28 UTC](https://meta.discourse.org/t/page-publishing/151971/160 "2023-06-08T00:28:58Z")

</div>

除非我错过了此功能的某些内容，否则已发布的页面仅显示初始帖子，而不显示对其的回答。如果这是预期的行为，是否有办法（插件？）使独立页面也显示对初始帖子的所有回复？

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [2023年六月8日 11:01 UTC](https://meta.discourse.org/t/page-publishing/151971/161 "2023-06-08T11:01:38Z")

</div>

> [@Wall-E](#):
>
> 已发布的页面仅显示初始帖子，而不显示对其的回复

你好 Raphael，

这就是已发布页面的目的。 🙂

已发布页面对许多 Discourse 功能的访问权限有限。  
唯一的解决方法是使用类似 [Page Publishing - #145 by denvergeeks](https://meta.discourse.org/t/page-publishing/151971/145?u=canapin) 的技巧，但已发布页面将没有自定义 URL（并且会在后台加载无用的东西）。

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [2023年六月8日 11:02 UTC](https://meta.discourse.org/t/page-publishing/151971/162 "2023-06-08T11:02:44Z")

</div>

你好，Danielle，

很遗憾，我除了建议你开启一个关于 #Contribute > Feature #page-publishing 的新话题并询问是否有办法解决之外，没有其他建议。

---

<div class="post-metadata">

### Author: ![agemo](https://avatars.discourse-cdn.com/v4/letter/a/ac91a4/32.png) [@agemo](https://meta.discourse.org/u/agemo)
#### Post date: [2023年七月10日 08:48 UTC](https://meta.discourse.org/t/page-publishing/151971/163 "2023-07-10T08:48:29Z")

</div>

> [@JQ331](#):
>
> 页面发布功能非常棒——这些主题可以作为独立的页面呈现。但我还没有能够按我希望的那样使用它：
> 
> 1. 我认为一个很棒的用途是将页面发布设置为论坛的着陆页——所以在用户登录之前，他们可以看到我已发布并样式化为他们看到的页面的主题。这可能吗？

页面发布是一个很棒的想法，也是一个对我来说全新的功能，特别是上面的内容，这正是我所设想的它的工作方式。

这可以让我们在拥有更多控制权的情况下展示内容，同时让大部分 Discourse 登录\_required，这是两全其美的方法。你可能仍然需要吸引新用户，或者将你想要公开给所有人（包括爬虫）的有价值的信息放在那里。

一个简单的选项，比如：

`允许已发布的页面显示在登录_required页面上`

这将是一个好的开始。

也许 `/pub/` 也可以作为默认的着陆页，自然地以简单的列表预览形式显示所有已发布的页面。

我直到调查了登录\_required 才真正知道这个功能可用。

---

<div class="post-metadata">

### Author: ![hellekin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hellekin/32/51636_2.png) [@hellekin](https://meta.discourse.org/u/hellekin)
#### Post date: [2023年七月20日 10:44 UTC](https://meta.discourse.org/t/page-publishing/151971/164 "2023-07-20T10:44:42Z")

</div>

# 索引已发布页面

在我们等待 [Index or search published pages](https://meta.discourse.org/t/index-or-search-published-pages/261301) 功能的同时，这里有一个手动实现的方法。

## 查找已发布页面

使用 [https://meta.discourse.org/t/discourse-data-explorer/32566/1，您可以创建一个新的](https://meta.discourse.org/t/discourse-data-explorer/32566/1%EF%BC%8C%E6%82%A8%E5%8F%AF%E4%BB%A5%E5%88%9B%E5%BB%BA%E4%B8%80%E4%B8%AA%E6%96%B0%E7%9A%84) **已发布页面** 查询：

```plaintext
SELECT CONCAT('/pub/', pp.slug) AS URL, pp.topic_id
FROM published_pages pp
ORDER BY pp.id

```

## 提供索引

当然，您可以 [Run Data Explorer queries with the Discourse API](https://meta.discourse.org/t/run-data-explorer-queries-with-the-discourse-api/120063) 来创建和维护已发布页面的索引。这甚至可能通过 [Custom Wizard Plugin 🧙](https://meta.discourse.org/t/custom-wizard-plugin/73345) 来实现。

我手动创建了一个新主题，使用了上面“已发布页面”查询的数据，然后在 `/pub/index` 处发布了它。

由于我 [https://meta.discourse.org/t/run-other-websites-on-the-same-machine-as-discourse/17247，我可以使用此代码段轻松地在](https://meta.discourse.org/t/run-other-websites-on-the-same-machine-as-discourse/17247%EF%BC%8C%E6%88%91%E5%8F%AF%E4%BB%A5%E4%BD%BF%E7%94%A8%E6%AD%A4%E4%BB%A3%E7%A0%81%E6%AE%B5%E8%BD%BB%E6%9D%BE%E5%9C%B0%E5%9C%A8) `https://discourse.example/pub` 处提供已发布页面索引：

```plaintext
    # 提供已发布页面的索引
    location ~* ^/pub/?$ {
        return 307 https://discourse.example/pub/index;
    }

```

---

<div class="post-metadata">

### Author: ![Richie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/richie/32/115110_2.png) [@Richie](https://meta.discourse.org/u/Richie)
#### Post date: [2023年十月26日 08:08 UTC](https://meta.discourse.org/t/page-publishing/151971/166 "2023-10-26T08:08:51Z")

</div>

> [@syl](#):
>
> 要在正常的 Discourse 布局中显示，即带有标准的 Discourse 头部（就像《服务条款》和《隐私政策》一样），以及

> [@sbernhard](#):
>
> 是否可以为“已发布页面”添加默认的 Discourse 头部？我的意思是，在左侧显示徽标，在右侧显示搜索、汉堡包图标、头像以及这些按钮的相关功能。

> [@reclaimedpress](#):
>
> 关于能否在已发布页面中包含 Discourse 头部，有任何更新吗？

> [@rsmithlal](#):
>
> 是否计划允许将这些已发布页面渲染到正常的 Discourse Ember 布局中？遗憾的是，您无法像其他应用程序部分一样将它们拉入布局。

> [@cokestroke](#):
>
> 是否可以使已发布页面保留站点头部不变？

我也加入这个列表 😊

---

<div class="post-metadata">

### Author: ![Richie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/richie/32/115110_2.png) [@Richie](https://meta.discourse.org/u/Richie)
#### Post date: [2023年十月26日 08:10 UTC](https://meta.discourse.org/t/page-publishing/151971/167 "2023-10-26T08:10:51Z")

</div>

是否有办法更改路由以从已发布页面的 URL 中移除 `/pub/`？

例如，此已发布页面：

`https://example.com/pub/my-magic-page-here`

将变为：

`https://example.com/my-magic-page-here`

🤔

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [2023年十一月15日 03:34 UTC](https://meta.discourse.org/t/page-publishing/151971/168 "2023-11-15T03:34:41Z")

</div>

您好 @Richie - 您可以使用永久链接（admin-customize-permalinks）来实现此目的。将“my-magic-page-here”的 slug 放在第一个字段中，在下拉菜单中使用“External URL”选项，然后在 URL 字段中添加已发布的页面 URL。但请注意，永久链接不能在自定义菜单部分用作 URL，仍然需要实际已发布的文档 URL。

---

<div class="post-metadata">

### Author: ![digitaldominica](https://avatars.discourse-cdn.com/v4/letter/d/97f17d/32.png) [@digitaldominica](https://meta.discourse.org/u/digitaldominica)
#### Post date: [2023年十二月30日 14:47 UTC](https://meta.discourse.org/t/page-publishing/151971/169 "2023-12-30T14:47:48Z")

</div>

您好，除了使用 CSS 来设置 `display: none` 之外，还有什么方法可以移除正在发布页面的用户？

另外，有没有办法添加一个返回论坛的链接？

---

<div class="post-metadata">

### Author: ![nathank](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nathank/32/290039_2.png) [@nathank](https://meta.discourse.org/u/nathank)
#### Post date: [2024年一月17日 06:25 UTC](https://meta.discourse.org/t/page-publishing/151971/170 "2024-01-17T06:25:48Z")

</div>

> [@digitaldominica](#):
>
> 除了使用 CSS 来实现 display none 之外，还有什么方法可以移除发布页面的用户？

另一种方法是将主题的所有者更改为 @system 或其他通用用户。

> [@digitaldominica](#):
>
> 另外，有没有办法添加一个返回论坛的链接？

最简单的方法是手动操作，只需在 OP markdown 中添加一个链接即可。

您或许可以轻松地创建一个 TC 来自动执行此操作（取决于您想要链接回什么）。可以尝试在 #Marketplace 中寻找相关服务。

---

<div class="post-metadata">

### Author: ![digitaldominica](https://avatars.discourse-cdn.com/v4/letter/d/97f17d/32.png) [@digitaldominica](https://meta.discourse.org/u/digitaldominica)
#### Post date: [2024年一月17日 08:52 UTC](https://meta.discourse.org/t/page-publishing/151971/171 "2024-01-17T08:52:56Z")

</div>

谢谢，我已经解决了。

[上一頁](https://meta.discourse.org/t/page-publishing/151971.md?page=2)

[下一頁](https://meta.discourse.org/t/page-publishing/151971.md?page=4)
