# 欢迎页眉文本 %{site\_name} 报错：无效的插值键：site\_name

**URL:** <https://meta.discourse.org/t/welcome-header-text-site-name-gives-error-the-following-interpolation-key-is-invalid-site-name/392604>\
**Category:** Support\
**Created:** [2026年一月3日 06:19 UTC](https://meta.discourse.org/t/welcome-header-text-site-name-gives-error-the-following-interpolation-key-is-invalid-site-name/392604 "2026-01-03T06:19:19Z")\
**Posts on this page:** 1\
**Showing post:** 16

<div class="post-metadata">

**Author:** ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)\
**Post date:** [2026年一月13日 11:39 UTC](https://meta.discourse.org/t/welcome-header-text-site-name-gives-error-the-following-interpolation-key-is-invalid-site-name/392604/16 "2026-01-13T11:39:23Z")

</div>

我不知道@NateDhaliwal 的想法是什么。我只是想指出一个替代方案，而不是向 `/about.json` 发出额外的请求。

我认为一个复制欢迎横幅但为所有文本提供 `site_name` 键的自定义组件是可行的。  
或者是一个 PR，它将 `site_name` 作为可用键添加到核心中已登录用户的文本中

 

```diff
  get headerText() {
    if (!this.currentUser) {
      return i18n("welcome_banner.header.anonymous_members", {
        site_name: this.siteSettings.title,
      });
    }

    const isNewUser = !this.currentUser.previous_visit_at;
    const key = isNewUser
      ? "welcome_banner.header.new_members"
      : "welcome_banner.header.logged_in_members";

    return i18n(key, {
      preferred_display_name: sanitize(
        prioritizeNameFallback(this.currentUser.name, this.currentUser.username)
      ),
+ site_name: this.siteSettings.title,
    });
  }

```

---

_[View the full topic](https://meta.discourse.org/t/welcome-header-text-site-name-gives-error-the-following-interpolation-key-is-invalid-site-name/392604)._
