# 如何将 \`/news\` 目录设为主页？

**URL:** <https://meta.discourse.org/t/best-way-to-make-the-news-directory-the-home-page/206197>\
**Category:** Support\
**Created:** [2021年十月16日 00:09 UTC](https://meta.discourse.org/t/best-way-to-make-the-news-directory-the-home-page/206197 "2021-10-16T00:09:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![BCHK](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bchk/32/3268_2.png) [@BCHK](https://meta.discourse.org/u/BCHK)\
**Post date:** [2021年十月16日 00:09 UTC](https://meta.discourse.org/t/best-way-to-make-the-news-directory-the-home-page/206197/1 "2021-10-16T00:09:39Z")

</div>

我正在我的新以论坛为核心的网站上使用 Pavillion 的新闻插件。

> [@News Plugin newspaper](https://meta.discourse.org/t/news-plugin/107971):
>
> The News Plugin adds a new “News” route to your forum. The latest topics in a category(s) (or from an RSS feed) are displayed in a large, news-like format, with an optional sidebar with a topic list. It adds a link to the News route in the header bar. It is inspired by the [Elektronauts news feed](https://www.elektronauts.com/news). [page_facing_up Get the code](https://github.com/paviliondev/discourse-news)[bug Report a bug](https://discourse.pluginmanager.org/w/bug-report)Lost? Not sure how to install a plugin? [Follow the steps here](https://meta.discourse.org/t/install-plugins-in-discourse/19157). Make sure you check out all the site se…

我参考此处的方式来实现它：

> **[Elektronauts](https://www.elektronauts.com/news)**
>
> The forum for users of Elektron Music Machines

但我想知道大家认为将重定向到 /news 目录的最佳方式是什么？

是 301 重定向吗？还是其他方式？是否存在权衡？非常感谢您的帮助。

---

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [2021年十月16日 00:29 UTC](https://meta.discourse.org/t/best-way-to-make-the-news-directory-the-home-page/206197/2 "2021-10-16T00:29:21Z")

</div>

您试过这个吗？[Custom Homepage for Groups](https://meta.discourse.org/t/custom-homepage-for-groups/199623?u=pfaffman)

---

<div class="post-metadata">

**Author:** ![rberger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rberger/32/103513_2.png) [@rberger](https://meta.discourse.org/u/rberger)\
**Post date:** [2021年十月17日 02:55 UTC](https://meta.discourse.org/t/best-way-to-make-the-news-directory-the-home-page/206197/3 "2021-10-17T02:55:14Z")

</div>

是否可以让“自定义群组主页”功能对未登录用户或任何群组的用户生效？即，为未特别指定的用户提供一个默认的替代主页？

---

<div class="post-metadata">

**Author:** ![Johani](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/johani/32/176920_2.png) [@Johani](https://meta.discourse.org/u/Johani)\
**Post date:** [2021年十月17日 03:25 UTC](https://meta.discourse.org/t/best-way-to-make-the-news-directory-the-home-page/206197/4 "2021-10-17T03:25:08Z")

</div>

我对新闻插件不太熟悉，但看起来它会在 `/news` 添加一个新路由。

因此，您可以在主题的“头部”选项卡中使用类似以下内容，将该路由设置为所有用户的默认主页。

```xml
<script type="text/discourse-plugin" version="0.8">
  const { setDefaultHomepage } = require('discourse/lib/utilities');
  setDefaultHomepage("news");
</script>

```

---

<div class="post-metadata">

**Author:** ![BCHK](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bchk/32/3268_2.png) [@BCHK](https://meta.discourse.org/u/BCHK)\
**Post date:** [2021年十月17日 05:51 UTC](https://meta.discourse.org/t/best-way-to-make-the-news-directory-the-home-page/206197/5 "2021-10-17T05:51:33Z")

</div>

你好，Jay。我已加载您的群组自定义主页，看起来不错。

关于主题组件的说明中，有一点我们不太理解：它是否支持匿名/未登录用户？

我们能否识别这个空组，并将他们引导至特定路径？

根据与该插件相关的少量文档，似乎无法实现这一点，但我可能理解有误。

非常感谢您的任何帮助。

---

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [2021年十月17日 07:49 UTC](https://meta.discourse.org/t/best-way-to-make-the-news-directory-the-home-page/206197/6 "2021-10-17T07:49:29Z")

</div>

我认为你可以使用 `everyone` 组，它包含匿名用户，但我尚未尝试。上述帖子看起来可行，而且相当简单。
