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

**URL:** <https://meta.discourse.org/t/best-way-to-make-the-news-directory-the-home-page/206197>\
**Category:** Product Support\
**Created:** [2021 年10 月 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:** 1\
**Showing post:** 4

<div class="post-metadata">

作者： ![Johani](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/johani/32/176920_2.png) [@Johani](https://meta.discourse.org/u/Johani)\
发布日期： [2021 年10 月 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>

```

---

_[View the full topic](https://meta.discourse.org/t/best-way-to-make-the-news-directory-the-home-page/206197)._
