# 使用新的自定义主页功能

**URL:** <https://meta.discourse.org/t/using-the-new-custom-homepage-feature/302496>\
**Category:** Development\
**Created:** [2024年四月4日 21:43 UTC](https://meta.discourse.org/t/using-the-new-custom-homepage-feature/302496 "2024-04-04T21:43:02Z")\
**Posts on this page:** 1\
**Showing post:** 46

<div class="post-metadata">

**Author:** ![pmusaraj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pmusaraj/32/119489_2.png) [@pmusaraj](https://meta.discourse.org/u/pmusaraj)\
**Post date:** [2025年三月25日 16:25 UTC](https://meta.discourse.org/t/using-the-new-custom-homepage-feature/302496/46 "2025-03-25T16:25:10Z")

</div>

> [@manuel](#):
>
> 这些功能可能是修饰符的默认设置？

也许……不确定。现在将此类添加到任何组件模板相对容易，您只需使用 `bodyClass` 助手即可。例如，在另一个主题中，我们这样做：

```js
  <template>
    {{bodyClass "custom-homepage"}}
  ...
  </template>

```

它实现了与 `onPageChange` 钩子相同的功能，但更可靠。它只会在组件渲染时将该类添加到 body。

> [@manuel](#):
>
> 我们能否改进主页的 FCP，并在应用程序的其余部分加载时使其呈现？

如果组件已拥有所需的所有数据，那么是的，没有理由不能与应用程序的其余部分一起渲染。但在大多数情况下，组件需要发出请求来获取一些额外数据，这会触发加载指示器。说实话，我想不出任何可以加快加载速度的简单方法。

* * *

既然我们在这里，我们对这项功能做了一些额外的改进。直到最近，自定义主页的爬虫视图还无法自定义。现在可以通过服务器端 HTML outlet 进行自定义：[DEV: Fix custom homepage crawler display and override by pmusaraj · Pull Request #31841 · discourse/discourse · GitHub](https://github.com/discourse/discourse/pull/31841)

---

_[View the full topic](https://meta.discourse.org/t/using-the-new-custom-homepage-feature/302496)._
