# 更新后丢失自定义页眉链接

**URL:** https://meta.discourse.org/t/missing-custom-header-links-after-update/262594
**Category:** Bug
**Tags:** custom-header-links
**Created:** [2023年四月22日 11:35 UTC](https://meta.discourse.org/t/missing-custom-header-links-after-update/262594 "2023-04-22T11:35:25Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![leopedrini](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/leopedrini/32/119430_2.png) [@leopedrini](https://meta.discourse.org/u/leopedrini)
#### Post date: [2023年四月22日 11:35 UTC](https://meta.discourse.org/t/missing-custom-header-links-after-update/262594/1 "2023-04-22T11:35:25Z")

</div>

你好。

我正在使用这个

[https://meta.discourse.org/t/custom-header-links/90588/155](https://meta.discourse.org/t/custom-header-links/90588/155)

但在更新后（10分钟前），链接丢失了（未显示）

 ![Missing Custom Header Links after update](https://global.discourse-cdn.com/meta/original/4X/3/6/c/36c9838cc0861e2e98aeea9b3434e86305e2a160.png)

---

<div class="post-metadata">

### Author: ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)
#### Post date: [2023年四月22日 12:28 UTC](https://meta.discourse.org/t/missing-custom-header-links-after-update/262594/2 "2023-04-22T12:28:22Z")

</div>

> <https://github.com/discourse/discourse-custom-header-links/pull/30#issuecomment-1491464250>
>
> @davidtaylorhq 
> 
> Hello ! As per the effort of the forum we're currently holdin…g, and to allow localization, we've added an attribute "locale" to links, which allows filtering of links according to the HTML's lang attribute !
> 
> For instance, if the link has "fr" tag for the french page, but the browser client has the english as default, then the link will not be pushed to the site's HTML :)
> 
> Thank you in advance for revieweing !

他们为链接添加了 locale 属性。这意味着，如果当前用户的语言是“fr”，则带有“en”标签的链接将不会显示。

不过，如果不提供 locale，它们应该默认显示。这里存在一个 bug。

立即的修复方法是在设置中为你的链接添加 `,en`。

---

<div class="post-metadata">

### Author: ![leopedrini](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/leopedrini/32/119430_2.png) [@leopedrini](https://meta.discourse.org/u/leopedrini)
#### Post date: [2023年四月22日 12:46 UTC](https://meta.discourse.org/t/missing-custom-header-links-after-update/262594/3 "2023-04-22T12:46:29Z")

</div>

> [@Arkshine](#):
>
> 立即的解决方法是在设置中为链接添加 `,en`。

谢谢，添加（变通方法）后，它又可以正常工作了：

 ![image](https://global.discourse-cdn.com/meta/original/4X/d/1/2/d127f73b5a0ce97b94f13d46579396c887147e09.png)

链接回来了：

 ![image](https://global.discourse-cdn.com/meta/original/4X/f/f/5/ff58a4281dffdedf8e66e548b9a7017e7b2f52d7.png)

注意：我不知道是否应该将此标记为“解决方案”（？），还是将其保留为“未解决”，因为未应用此变通方法的人也会遇到此问题。

另外，我知道我应该阅读该组件的所有文档，并添加了 `", en"`…… ☹

---

<div class="post-metadata">

### Author: ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)
#### Post date: [2023年四月22日 13:09 UTC](https://meta.discourse.org/t/missing-custom-header-links-after-update/262594/4 "2023-04-22T13:09:58Z")

</div>

> [@leopedrini](#):
>
> 注意：我不知道是否应该将其标记为“解决方案(?)”或将其保留为“未解决”，因为问题将显示给那些不应用此解决方法的人。

这仍然是一个错误。我已提交一个 PR 来修复它：

> <https://github.com/discourse/discourse-custom-header-links/pull/31>
>
> Related #30.
> Reported here: https://meta.discourse.org/t/missing-custom-header-…links-after-update/262594
> 
> \#### Current behavior
> The links are not displayed if a locale is not provided in the setting.
> 
> \#### Expected behavior
> By not associating a locale with a link, the link should be displayed by default.
> 
> \---
> 
> Unpacking a value from \`split\` that doesn't exist (here \`locale\`) will return \`undefined\`.

---

<div class="post-metadata">

### Author: ![jordan.vidrine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jordan.vidrine/32/515563_2.png) [@jordan.vidrine](https://meta.discourse.org/u/jordan.vidrine)
#### Post date: [2023年四月24日 14:09 UTC](https://meta.discourse.org/t/missing-custom-header-links-after-update/262594/6 "2023-04-24T14:09:49Z")

</div>

已批准并合并 👍

---

<div class="post-metadata">

### Author: ![awesomerobot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awesomerobot/32/142900_2.png) [@awesomerobot](https://meta.discourse.org/u/awesomerobot)
#### Post date: [2023年八月1日 19:32 UTC](https://meta.discourse.org/t/missing-custom-header-links-after-update/262594/10 "2023-08-01T19:32:09Z")

</div>


