# 其URL中从“tags”更改为“tag”会影响我的Discourse，因为它们在许多帖子中都有链接。如何自动更改它们？

**URL:** https://meta.discourse.org/t/the-change-of-from-tags-to-tag-in-its-url-affects-my-discourse-since-they-are-linked-in-many-posts-how-can-i-automatically-change-them/231433
**Category:** Support
**Created:** [2022 年6 月 29 日 10:11 UTC](https://meta.discourse.org/t/the-change-of-from-tags-to-tag-in-its-url-affects-my-discourse-since-they-are-linked-in-many-posts-how-can-i-automatically-change-them/231433 "2022-06-29T10:11:58Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### 作者： ![nujabes](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nujabes/32/135752_2.png) [@nujabes](https://meta.discourse.org/u/nujabes)
#### 发布日期： [2022 年6 月 29 日 10:11 UTC](https://meta.discourse.org/t/the-change-of-from-tags-to-tag-in-its-url-affects-my-discourse-since-they-are-linked-in-many-posts-how-can-i-automatically-change-them/231433/1 "2022-06-29T10:11:58Z")

</div>

我注意到现在所有 URL 中包含“tags”的链接在我的 Discourse 中都无法正常工作，而是使用了“tag”。我该如何自动更改我设置的旧 URL 链接？有很多，所以手动更改完全不可能。我的 Discourse 版本是 2.9.0.beta4。

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

---

<div class="post-metadata">

### 作者： ![Ed\_S](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ed_s/32/134015_2.png) [@Ed\_S](https://meta.discourse.org/u/Ed_S)
#### 发布日期： [2022 年6 月 29 日 10:30 UTC](https://meta.discourse.org/t/the-change-of-from-tags-to-tag-in-its-url-affects-my-discourse-since-they-are-linked-in-many-posts-how-can-i-automatically-change-them/231433/2 "2022-06-29T10:30:27Z")

</div>

在我的论坛上，它们非常普通，没有任何特殊的设置，/tags/ 会自动重定向到 /tag/。请注意，我运行的是最新的 2.9.0.beta5 版本 - 我不知道这是否是某个已更改的内容。（你最好还是更新一下。）

编辑：但请看下面！我现在同意存在一个问题。

---

<div class="post-metadata">

### 作者： ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### 发布日期： [2022 年6 月 29 日 10:33 UTC](https://meta.discourse.org/t/the-change-of-from-tags-to-tag-in-its-url-affects-my-discourse-since-they-are-linked-in-many-posts-how-can-i-automatically-change-them/231433/3 "2022-06-29T10:33:41Z")

</div>

让我们举个例子：🙂

`https://meta.discourse.org/tags/getting-started`

[https://meta.discourse.org/tags/getting-started](https://meta.discourse.org/tags/getting-started)

（虽然它似乎不喜欢我用`<>`包裹它 [https://meta.discourse.org/tags/getting-started](https://meta.discourse.org/tags/getting-started)）

---

<div class="post-metadata">

### 作者： ![Ed\_S](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ed_s/32/134015_2.png) [@Ed\_S](https://meta.discourse.org/u/Ed_S)
#### 发布日期： [2022 年6 月 29 日 11:07 UTC](https://meta.discourse.org/t/the-change-of-from-tags-to-tag-in-its-url-affects-my-discourse-since-they-are-linked-in-many-posts-how-can-i-automatically-change-them/231433/4 "2022-06-29T11:07:05Z")

</div>

啊，绝佳的例子！因此，确实，虽然新请求的网址（在网址栏中）会得到重定向处理，但帖子的网址不会。\n\n你能把它移到 bug 类别吗？我认为这是合理的。

---

<div class="post-metadata">

### 作者： ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### 发布日期： [2022 年6 月 29 日 11:22 UTC](https://meta.discourse.org/t/the-change-of-from-tags-to-tag-in-its-url-affects-my-discourse-since-they-are-linked-in-many-posts-how-can-i-automatically-change-them/231433/5 "2022-06-29T11:22:26Z")

</div>

我还以为内联 onebox 示例能正常工作，结果它没行，然后又行了。刷新“出错”页面后它也能正常工作。🙂 我稍微调查了一下，发现了一个现有的 #Contribute > Bug 主题，看起来说的是同一件事：

> [@将TAGS切换到TAG导致帖子中的链接和“删除未使用标签”损坏](https://meta.discourse.org/t/switch-from-tags-to-tag-broke-links-in-posts-and-delete-unused-tags/203892):
>
> 我们的论坛软件已在约两周前更新至 2.8.0.beta6 版本。 此前，URL 中的 tags 既用于 [总览](https://meta.discourse.org/tags)，也用于各个标签。但现在，后者要求 URL 中使用 tag，因此现有帖子中的所有链接都会跳转到 哎呀！该页面不存在或为私密页面。 页面。 我在本 [表格](https://forums.crateentertainment.com/t/build-compendiums/82060/4) 中大量使用了此类链接。我本可以更新这些 URL，但这会重置点击计数器。 纯属巧合，我今天注意到已设置了重定向，但该重定向仅在编辑器预览中有效，或者在地址栏中输入/编辑 URL 时才有效。因此，作为临时解决方案，用户需要刷新页面。 此外，“删除未使用的标签”功能似乎为空。然而，我们确实有一些已保留但未使用的标签。

该报告中的原作者为了绕过这个问题重命名了他们的标签，不过我不确定他们是手动操作的，还是使用了 [Replace a string in all posts](https://meta.discourse.org/t/replace-a-string-in-all-posts/48729) 。

---

<div class="post-metadata">

### 作者： ![eisprinzessin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eisprinzessin/32/234408_2.png) [@eisprinzessin](https://meta.discourse.org/u/eisprinzessin)
#### 发布日期： [2022 年6 月 29 日 16:20 UTC](https://meta.discourse.org/t/the-change-of-from-tags-to-tag-in-its-url-affects-my-discourse-since-they-are-linked-in-many-posts-how-can-i-automatically-change-them/231433/6 "2022-06-29T16:20:43Z")

</div>

感谢您挖出我的 bug 报告。我只是我们论坛的版主，无法访问数据库来编辑所有受影响的帖子。主要 concerns 是保持那个非常突出的帖子功能正常，因为它链接到数十个标签。所以，这是一项手动工作。

---

<div class="post-metadata">

### 作者： ![nujabes](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nujabes/32/135752_2.png) [@nujabes](https://meta.discourse.org/u/nujabes)
#### 发布日期： [2022 年6 月 30 日 03:40 UTC](https://meta.discourse.org/t/the-change-of-from-tags-to-tag-in-its-url-affects-my-discourse-since-they-are-linked-in-many-posts-how-can-i-automatically-change-them/231433/7 "2022-06-30T03:40:12Z")

</div>

感谢大家。

如果这是一个 bug 并且保持不变，我将手动将旧的“tags” URL 更改为“tag”的 URL。

但是，我想知道 Discourse 从现在开始是否使用“tag”而不是“tags”。如果 Discourse 认为使用“tags”一如既往地更好，我将不会修复我论坛上的链接。如果 Discourse 继续使用“tag”，我将别无选择，只能自己手动修复所有内容。

我担心可能还有其他 Discourse 用户将旧的“tags” URL 设置为链接。他们可能没有注意到这一点。如果 Discourse 将当前的“tag”更改为以前的“tags”，这些用户和我将不必处理这个问题。您怎么看？我应该将此帖子发布到 bug 类别吗？

---

<div class="post-metadata">

### 作者： ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### 发布日期： [2022 年6 月 30 日 05:52 UTC](https://meta.discourse.org/t/the-change-of-from-tags-to-tag-in-its-url-affects-my-discourse-since-they-are-linked-in-many-posts-how-can-i-automatically-change-them/231433/8 "2022-06-30T05:52:14Z")

</div>

> [@nujabes](#):
>
> 你觉得呢？我应该把这个发在 bug 分类里吗？

无需重复发帖——我已经标记了此主题和之前的 bug 报告以引起注意，希望能尽快为您提供一些信息。🤞

---

<div class="post-metadata">

### 作者： ![nujabes](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nujabes/32/135752_2.png) [@nujabes](https://meta.discourse.org/u/nujabes)
#### 发布日期： [2022 年6 月 30 日 06:13 UTC](https://meta.discourse.org/t/the-change-of-from-tags-to-tag-in-its-url-affects-my-discourse-since-they-are-linked-in-many-posts-how-can-i-automatically-change-them/231433/9 "2022-06-30T06:13:57Z")

</div>

好的。同时，我将保持断开的链接不变。

---

<div class="post-metadata">

### 作者： ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### 发布日期： [2022 年7 月 9 日 06:58 UTC](https://meta.discourse.org/t/the-change-of-from-tags-to-tag-in-its-url-affects-my-discourse-since-they-are-linked-in-many-posts-how-can-i-automatically-change-them/231433/10 "2022-07-09T06:58:46Z")

</div>

我相信这已在以下位置修复：

> <https://github.com/discourse/discourse/pull/17397>
>
> /tags/:tag\_id is deprecated, but links may exist in posts.

我刚刚对照上面发布的示例进行了检查，现在它似乎运行得更加一致，无需刷新页面。您能否尝试更新您的 Discourse 并查看这是否能为您解决问题？

---

<div class="post-metadata">

### 作者： ![nujabes](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nujabes/32/135752_2.png) [@nujabes](https://meta.discourse.org/u/nujabes)
#### 发布日期： [2022 年7 月 11 日 07:17 UTC](https://meta.discourse.org/t/the-change-of-from-tags-to-tag-in-its-url-affects-my-discourse-since-they-are-linked-in-many-posts-how-can-i-automatically-change-them/231433/11 "2022-07-11T07:17:40Z")

</div>

感谢您及时改进。  
我的论坛使用的是 2.9.0.beta4。我应该将其更新到最新的 2.9.0.beta6 吗？

---

<div class="post-metadata">

### 作者： ![nujabes](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nujabes/32/135752_2.png) [@nujabes](https://meta.discourse.org/u/nujabes)
#### 发布日期： [2022 年7 月 15 日 09:14 UTC](https://meta.discourse.org/t/the-change-of-from-tags-to-tag-in-its-url-affects-my-discourse-since-they-are-linked-in-many-posts-how-can-i-automatically-change-them/231433/12 "2022-07-15T09:14:18Z")

</div>

它与 2.9.0 beta6 配合得很好。谢谢！

---

<div class="post-metadata">

### 作者： ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### 发布日期： [2022 年8 月 16 日 09:49 UTC](https://meta.discourse.org/t/the-change-of-from-tags-to-tag-in-its-url-affects-my-discourse-since-they-are-linked-in-many-posts-how-can-i-automatically-change-them/231433/13 "2022-08-16T09:49:16Z")

</div>


