# 自定义页眉链接无法显示？

**URL:** https://meta.discourse.org/t/cannot-get-the-custom-header-links-to-display/277643
**Category:** Support
**Tags:** custom-header-links
**Created:** [2023年九月3日 13:06 UTC](https://meta.discourse.org/t/cannot-get-the-custom-header-links-to-display/277643 "2023-09-03T13:06:45Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![lejeczek](https://avatars.discourse-cdn.com/v4/letter/l/edb3f5/32.png) [@lejeczek](https://meta.discourse.org/u/lejeczek)
#### Post date: [2023年九月3日 13:06 UTC](https://meta.discourse.org/t/cannot-get-the-custom-header-links-to-display/277643/1 "2023-09-03T13:06:45Z")

</div>

大家好。  
作为新手，我必须假设我遗漏了什么。  
我在_自定义_ → _主题_中添加了 **包含的组件** ： **自定义页眉链接**  
然后在_组件_ → _自定义页眉链接_中，我添加了 **在…上包含组件** ： **默认**

当用户未登录时，预设链接或我自己的链接都不会出现在页眉中，页眉右侧只有_登录_、_注册_和搜索图标。  
我遗漏了什么？

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [2023年九月3日 13:13 UTC](https://meta.discourse.org/t/cannot-get-the-custom-header-links-to-display/277643/2 "2023-09-03T13:13:08Z")

</div>

确保您实际使用的是默认主题作为您的主题。

 ![IMG_0309](https://global.discourse-cdn.com/meta/original/4X/e/3/8/e38a6df2715b96e99df331b779ac769ac7551f82.jpeg)

您还可以通过底部使用的预览按钮来预览它或组件，以检查设置。这使得在将组件和主题推广给论坛用户之前更容易设置它们。

另外，请仔细检查以确保您在组件中正确设置了页眉链接。查看默认的链接以了解它们的设置方式。

 ![IMG_0310](https://global.discourse-cdn.com/meta/original/4X/e/3/d/e3dceeb53e3c8a49ad6f4edd4280fda406b842bc.jpeg)

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [2023年九月3日 13:22 UTC](https://meta.discourse.org/t/cannot-get-the-custom-header-links-to-display/277643/3 "2023-09-03T13:22:03Z")

</div>

我刚在我的测试网站上试了一下，我的也没有显示出来。

它在检查器里，但不知为何是灰色的？

 ![image](https://global.discourse-cdn.com/meta/original/4X/6/b/4/6b4ec594f7eb02126e9e18d5561d2ab1d27750bb.png)

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [2023年九月3日 13:23 UTC](https://meta.discourse.org/t/cannot-get-the-custom-header-links-to-display/277643/4 "2023-09-03T13:23:57Z")

</div>

正在处理我的 \n\n

 ![IMG_0311](https://global.discourse-cdn.com/meta/original/4X/6/d/4/6d405529b2d2413ee61bc958c9659fa2d29c352b.jpeg)

---

<div class="post-metadata">

### Author: ![lejeczek](https://avatars.discourse-cdn.com/v4/letter/l/edb3f5/32.png) [@lejeczek](https://meta.discourse.org/u/lejeczek)
#### Post date: [2023年九月3日 13:25 UTC](https://meta.discourse.org/t/cannot-get-the-custom-header-links-to-display/277643/5 "2023-09-03T13:25:53Z")

</div>

是的，我有这些。_主题_ → _默认_ → _主题默认启用_  
设置几乎是原生的，这是一个测试实验室。  
看起来 CHL 对我的设置、预览或未登录用户没有任何影响，根本没有页眉。  
未登录用户 → 仅_注册_和_登录_，  
登录用户只有三个图标：聊天、搜索、用户。  
版本是 3.0.6

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [2023年九月3日 13:28 UTC](https://meta.discourse.org/t/cannot-get-the-custom-header-links-to-display/277643/6 "2023-09-03T13:28:52Z")

</div>

> [@lejeczek](#):
>
> 版本是 3.0.6

您应该升级到 3.10 或 3.2.0 beta1-dev

我强烈建议您升级您的 Discourse，因为自该版本以来，核心已发生重大变化，其中一些变化影响了主题组件。

---

<div class="post-metadata">

### Author: ![lejeczek](https://avatars.discourse-cdn.com/v4/letter/l/edb3f5/32.png) [@lejeczek](https://meta.discourse.org/u/lejeczek)
#### Post date: [2023年九月3日 13:29 UTC](https://meta.discourse.org/t/cannot-get-the-custom-header-links-to-display/277643/7 "2023-09-03T13:29:18Z")

</div>

> [@JammyDodger](#):
>
> 它在检查器中，但不知何故是灰色的？

我也看到了，就是那样。

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [2023年九月3日 13:38 UTC](https://meta.discourse.org/t/cannot-get-the-custom-header-links-to-display/277643/8 "2023-09-03T13:38:07Z")

</div>

经过一番调整，我认为是示例链接 ~~已过时。我认为最近对纯粹的 `/` 的处理方式有所改变~~ 导致了问题。

删除所有示例链接并添加类似以下内容：

`A link, a link, https://meta.discourse.org, vdm, blank`

确实有效：

 ![image](https://global.discourse-cdn.com/meta/original/4X/4/2/7/427778b19ce23349d7e28b198d953a4935c47268.png)

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [2023年九月3日 13:41 UTC](https://meta.discourse.org/t/cannot-get-the-custom-header-links-to-display/277643/9 "2023-09-03T13:41:31Z")

</div>

字段描述还显示了一个新的语言区域设置（请参阅上面[我的第二个截图](https://meta.discourse.org/t/cannot-get-it-to-work/277643/2?u=lilly)）：thinking:

供参考，我刚刚下载并安装了该组件，没有更改任何内容，包括默认链接，它就能正常工作 🤷🏻‍♀️

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [2023年九月3日 13:48 UTC](https://meta.discourse.org/t/cannot-get-the-custom-header-links-to-display/277643/10 "2023-09-03T13:48:47Z")

</div>

> [@Lilly](#):
>
> 字段描述还显示了一个新的语言区域设置（请参阅我上面的第一个屏幕截图）：思考：

我认为你找到了获胜者。：奖杯：：微笑：

当我从示例中删除区域设置时，它们就会显示出来。：+1：

一定是因为我不在“en”上。这有点令人困惑。：微笑：

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [2023年九月3日 13:58 UTC](https://meta.discourse.org/t/cannot-get-the-custom-header-links-to-display/277643/12 "2023-09-03T13:58:21Z")

</div>

是的，我在用英文，这说得通。\n\n@lejeczek 如果你移除字段字符串末尾的 en|language 设置，它应该就能工作了。

---

<div class="post-metadata">

### Author: ![lejeczek](https://avatars.discourse-cdn.com/v4/letter/l/edb3f5/32.png) [@lejeczek](https://meta.discourse.org/u/lejeczek)
#### Post date: [2023年九月3日 13:59 UTC](https://meta.discourse.org/t/cannot-get-the-custom-header-links-to-display/277643/13 "2023-09-03T13:59:54Z")

</div>

对我来说没有区别。安装 CHL 时，预设链接已包含在内，请解释一下 @Lilly 捕捉到了什么，例如预设链接的地区：

_外部链接，此链接将在新标签页中打开，[https://meta.discourse.org](https://meta.discourse.org)，vdo，空白，删除，en_

添加一个类似的链接也没有效果。

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [2023年九月3日 14:01 UTC](https://meta.discourse.org/t/cannot-get-the-custom-header-links-to-display/277643/14 "2023-09-03T14:01:09Z")

</div>

您能完全不带区域设置试试吗？该设置选项可能需要更新版本的 Discourse 才能生效。

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [2023年九月3日 14:03 UTC](https://meta.discourse.org/t/cannot-get-the-custom-header-links-to-display/277643/15 "2023-09-03T14:03:11Z")

</div>

@lejeczek 请粘贴您的设置编辑器内容？（组件右下角的按钮）

---

<div class="post-metadata">

### Author: ![lejeczek](https://avatars.discourse-cdn.com/v4/letter/l/edb3f5/32.png) [@lejeczek](https://meta.discourse.org/u/lejeczek)
#### Post date: [2023年九月3日 14:07 UTC](https://meta.discourse.org/t/cannot-get-the-custom-header-links-to-display/277643/16 "2023-09-03T14:07:44Z")

</div>

无论结尾是否有 locale/lang，结果都一样。

 ![CHL](https://global.discourse-cdn.com/meta/original/4X/1/4/4/144404e1a66ed0d8e54f3cf7236fc19967a2b158.png)

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [2023年九月3日 14:09 UTC](https://meta.discourse.org/t/cannot-get-the-custom-header-links-to-display/277643/17 "2023-09-03T14:09:01Z")

</div>

哦，奇怪，你没有设置编辑器按钮。可能需要升级你的 Discourse。

更改设置后，你是否刷新了页面？

作为参考，这是我在本地开发的 Discourse 安装中的设置。我编辑了第一个指向 Meta 的默认设置，并为我的 FAQ 页面添加了一个设置，以确保非默认设置也能正常工作。

```plaintext
Meta, will open in a new tab to Discourse Meta, https://meta.discourse.org, vdo, blank, remove
Most Liked, Posts with the most amount of likes, /latest/?order=op_likes, vdo, self, keep
Privacy, Our Privacy Policy, /privacy, vdm, self, keep
FAQ, Frequently Asked Questions, /faq, vdm, self, keep

```

这是使用测试用户（非管理员）的结果。

 ![headerlinks](https://global.discourse-cdn.com/meta/original/4X/1/e/e/1ee2fc10274225dea076463d8a846d0a06340b65.png)

作为建议，我建议在移动视图中将链接数量限制为一到两个。在移动/小屏幕视图中，该标题会很快变得拥挤，尤其是对于带有登录/注册按钮的匿名用户。
