# 隐藏内容的部分视图

**URL:** https://meta.discourse.org/t/partial-view-of-hidden-content/140758
**Category:** Feature
**Created:** [2020年二月5日 16:34 UTC](https://meta.discourse.org/t/partial-view-of-hidden-content/140758 "2020-02-05T16:34:52Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![dylanb](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dylanb/32/139102_2.png) [@dylanb](https://meta.discourse.org/u/dylanb)
#### Post date: [2020年二月5日 16:34 UTC](https://meta.discourse.org/t/partial-view-of-hidden-content/140758/1 "2020-02-05T16:34:52Z")

</div>

您好，

我运营一个会员网站，并使用 Discourse 进行讨论。会员被分配到特定群组，该群组可以查看某些分类下的帖子。

如果未登录且不属于该群组的人尝试访问这些帖子，他们只会看到一条消息：“哎呀！该页面不存在或是私有的。”

有没有办法让这些帖子可见，甚至显示前几篇帖子，但隐藏其余内容，并显示某种提示说明该内容仅限该群组会员查看？

设想效果如下：

 ![image](https://global.discourse-cdn.com/meta/original/3X/1/7/177eab70d9717ec1f211b8c366f0e976857b2dc2.png)

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2020年二月6日 10:27 UTC](https://meta.discourse.org/t/partial-view-of-hidden-content/140758/2 "2020-02-06T10:27:42Z")

</div>

我们有点反对这种付费墙的做法。

不过，如果你想要推广“秘密”内容，可以在一个带横幅的主题中手动发布广告。

---

<div class="post-metadata">

### Author: ![dylanb](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dylanb/32/139102_2.png) [@dylanb](https://meta.discourse.org/u/dylanb)
#### Post date: [2020年二月6日 14:41 UTC](https://meta.discourse.org/t/partial-view-of-hidden-content/140758/3 "2020-02-06T14:41:25Z")

</div>

我想更大的问题是，Discourse 支持的仅限会员的内容区域，其提示更像是一个 404 错误，而不是提示“此处有内容”。

如果能自定义那个“哎呀！该页面不存在或为私密页面”的屏幕，也会很有帮助。

---

<div class="post-metadata">

### Author: ![Anatolia](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/anatolia/32/133777_2.png) [@Anatolia](https://meta.discourse.org/u/Anatolia)
#### Post date: [2020年二月6日 14:55 UTC](https://meta.discourse.org/t/partial-view-of-hidden-content/140758/4 "2020-02-06T14:55:25Z")

</div>

也许提示信息应该是“您必须是 X 组的成员才能查看此页面”，而不是“哎呀！该页面不存在或为私密页面”。

---

<div class="post-metadata">

### Author: ![Paracelsus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/paracelsus/32/164912_2.png) [@Paracelsus](https://meta.discourse.org/u/Paracelsus)
#### Post date: [2020年二月6日 16:06 UTC](https://meta.discourse.org/t/partial-view-of-hidden-content/140758/5 "2020-02-06T16:06:56Z")

</div>

@dylanb 安装静态页面插件（我想是 Procourse 相关的），然后在导航栏上添加一个自定义链接（有现成的主题组件可用），指向该页面。

静态页面可以类似于 TekInvestor 上的这个页面：[https://tekinvestor.com/tekinvestor-data/tekinvestor-sales-pages/generic.html](https://tekinvestor.com/tekinvestor-data/tekinvestor-sales-pages/generic.html)  
或者截取一个“不可见”分类的主题列表截图，这样人们就能预览其外观。

---

<div class="post-metadata">

### Author: ![marianord](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/marianord/32/90502_2.png) [@marianord](https://meta.discourse.org/u/marianord)
#### Post date: [2020年二月6日 17:21 UTC](https://meta.discourse.org/t/partial-view-of-hidden-content/140758/6 "2020-02-06T17:21:20Z")

</div>

我倾向于类似“此页面存在，但你没有访问权限”的提示，这样既能适用于未登录用户，也能适用于明确被禁止访问的用户。同时，这也能与 404 错误区分开来。

这不是紧急功能，只是一个锦上添花的选项。

---

<div class="post-metadata">

### Author: ![SrhKnpp](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/srhknpp/32/173417_2.png) [@SrhKnpp](https://meta.discourse.org/u/SrhKnpp)
#### Post date: [2020年四月28日 21:21 UTC](https://meta.discourse.org/t/partial-view-of-hidden-content/140758/7 "2020-04-28T21:21:44Z")

</div>

既然这并非完全私密的区域，类似这样的做法是否可能对 SEO 有所帮助？

---

<div class="post-metadata">

### Author: ![awesomerobot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awesomerobot/32/142900_2.png) [@awesomerobot](https://meta.discourse.org/u/awesomerobot)
#### Post date: [2020年四月28日 21:57 UTC](https://meta.discourse.org/t/partial-view-of-hidden-content/140758/8 "2020-04-28T21:57:44Z")

</div>

既对也不对。它确实能让内容更容易被发现，因为 Google 可以索引某些内容……但如果绝大多数流量因为必须注册才能查看完整内容而感到不满，随即立刻离开页面，那么你的排名也很难靠前。

---

<div class="post-metadata">

### Author: ![SrhKnpp](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/srhknpp/32/173417_2.png) [@SrhKnpp](https://meta.discourse.org/u/SrhKnpp)
#### Post date: [2020年四月28日 22:05 UTC](https://meta.discourse.org/t/partial-view-of-hidden-content/140758/9 "2020-04-28T22:05:57Z")

</div>

这很有道理。谢谢！

---

<div class="post-metadata">

### Author: ![dylanb](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dylanb/32/139102_2.png) [@dylanb](https://meta.discourse.org/u/dylanb)
#### Post date: [2020年四月28日 23:22 UTC](https://meta.discourse.org/t/partial-view-of-hidden-content/140758/10 "2020-04-28T23:22:22Z")

</div>

> [@SrhKnpp](#):
>
> 既然这并非完全私密的空间，类似这样的功能是否可能对 SEO 有所帮助？

从会员制网站的角度来看，是的。这正是我原本打算/期望的效果，但 Discourse 社区的成员们已经相当有力地阐述了他们反对的理由。

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2020年四月28日 23:49 UTC](https://meta.discourse.org/t/partial-view-of-hidden-content/140758/11 "2020-04-28T23:49:49Z")

</div>

对于会员网站，您通常会有一个主域名，例如 `example.com`，上面有大量精彩的内容，然后还有一个 `discuss.example.com` 或 `talk.example.com`，供会员访问，对吗？

---

<div class="post-metadata">

### Author: ![xav](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/xav/32/153918_2.png) [@xav](https://meta.discourse.org/u/xav)
#### Post date: [2020年六月29日 20:05 UTC](https://meta.discourse.org/t/partial-view-of-hidden-content/140758/12 "2020-06-29T20:05:05Z")

</div>

一个改进是提供一个更清晰的 404 页面，以区分“内容不存在”和“内容为私有”两种情况。

> [@Different error pages for 404 (not found) and 401 (private)](https://meta.discourse.org/t/different-error-pages-for-404-not-found-and-401-private/155798/):
>
> (context: I’m having a forum with a lot of private groups/categories for working groups) When a visitor goes to a private category, they get a: Oops! That page doesn’t exist or is private with additional features (go see the top posts…) that are tailored to a page not found My users tell me it’s confusing and most don’t see the “or is private”. Is is possible for categories (or topics) that are private to display the title or the description have a more visible “login” link have a “registe…

---

<div class="post-metadata">

### Author: ![dylanb](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dylanb/32/139102_2.png) [@dylanb](https://meta.discourse.org/u/dylanb)
#### Post date: [2020年六月29日 20:05 UTC](https://meta.discourse.org/t/partial-view-of-hidden-content/140758/13 "2020-06-29T20:05:59Z")

</div>

太棒了。有没有办法在这个页面上添加自定义内容？具体来说，就是在“它是私有的”文字下方添加一个登录或注册/订阅的链接？

---

<div class="post-metadata">

### Author: ![xav](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/xav/32/153918_2.png) [@xav](https://meta.discourse.org/u/xav)
#### Post date: [2020年六月29日 20:07 UTC](https://meta.discourse.org/t/partial-view-of-hidden-content/140758/14 "2020-06-29T20:07:10Z")

</div>

有点不清楚，而且多了一个“前往群组”的页面，但没错，这就是它开箱即用的行为。

---

<div class="post-metadata">

### Author: ![xav](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/xav/32/153918_2.png) [@xav](https://meta.discourse.org/u/xav)
#### Post date: [2020年六月29日 20:07 UTC](https://meta.discourse.org/t/partial-view-of-hidden-content/140758/15 "2020-06-29T20:07:55Z")

</div>

但如果您能为这个“无访问权限”页面的自定义定制提供贡献或资金支持，那就太棒了！

---

<div class="post-metadata">

### Author: ![dylanb](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dylanb/32/139102_2.png) [@dylanb](https://meta.discourse.org/u/dylanb)
#### Post date: [2020年六月29日 20:08 UTC](https://meta.discourse.org/t/partial-view-of-hidden-content/140758/16 "2020-06-29T20:08:01Z")

</div>

当我启用该设置时，我只看到：

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

---

<div class="post-metadata">

### Author: ![xav](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/xav/32/153918_2.png) [@xav](https://meta.discourse.org/u/xav)
#### Post date: [2020年六月29日 20:09 UTC](https://meta.discourse.org/t/partial-view-of-hidden-content/140758/17 "2020-06-29T20:09:26Z")

</div>

啊？我这边有一个“申请加入”的链接。不确定为什么你没有看到。你使用的是最新版的 Discourse 吗？

或者，你是在尝试访问某个私密分类下的特定帖子？

---

<div class="post-metadata">

### Author: ![dylanb](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dylanb/32/139102_2.png) [@dylanb](https://meta.discourse.org/u/dylanb)
#### Post date: [2020年六月29日 20:13 UTC](https://meta.discourse.org/t/partial-view-of-hidden-content/140758/18 "2020-06-29T20:13:25Z")

</div>

> [@xav](#):
>
> 或者你是在尝试访问私密分类中的特定帖子？

我尝试访问该分类中的特定帖子。

该分类在无痕模式下仍然显示此内容：

 ![image](https://global.discourse-cdn.com/meta/original/3X/5/9/597e88eab7b593de3dcef19b3f14b5f041a473b4.png)

我打算升级，但看起来版本已经是最新的，除了最近几次提交外。

---

<div class="post-metadata">

### Author: ![xav](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/xav/32/153918_2.png) [@xav](https://meta.discourse.org/u/xav)
#### Post date: [2020年六月29日 20:16 UTC](https://meta.discourse.org/t/partial-view-of-hidden-content/140758/19 "2020-06-29T20:16:44Z")

</div>

我目前的情况是，某个类别仅限单个群组访问，并且我有一个更清晰的错误页面。

你是如何配置该类别的访问权限的？你是否配置了不止一个群组？

---

<div class="post-metadata">

### Author: ![dylanb](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dylanb/32/139102_2.png) [@dylanb](https://meta.discourse.org/u/dylanb)
#### Post date: [2020年六月29日 20:23 UTC](https://meta.discourse.org/t/partial-view-of-hidden-content/140758/20 "2020-06-29T20:23:01Z")

</div>

只有一个群组，但似乎无法访问您提供的页面。也许是因为我通过 WordPress 使用了单点登录（SSO）？

 ![image](https://global.discourse-cdn.com/meta/original/3X/3/0/30133311f83c6d1cd36d070e91f3b10628e1da27.png)

[下一頁](https://meta.discourse.org/t/partial-view-of-hidden-content/140758.md?page=2)
