# 将TAGS切换到TAG导致帖子中的链接和“删除未使用标签”损坏

**URL:** https://meta.discourse.org/t/switch-from-tags-to-tag-broke-links-in-posts-and-delete-unused-tags/203892
**Category:** Bug
**Created:** [2021 年9 月 18 日 10:50 UTC](https://meta.discourse.org/t/switch-from-tags-to-tag-broke-links-in-posts-and-delete-unused-tags/203892 "2021-09-18T10:50:16Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![eisprinzessin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eisprinzessin/32/234408_2.png) [@eisprinzessin](https://meta.discourse.org/u/eisprinzessin)
#### Post date: [2021 年9 月 18 日 10:50 UTC](https://meta.discourse.org/t/switch-from-tags-to-tag-broke-links-in-posts-and-delete-unused-tags/203892/1 "2021-09-18T10:50:16Z")

</div>

我们的论坛软件已在约两周前更新至 2.8.0.beta6 版本。

- 此前，URL 中的 _ **tags** _ 既用于 [总览](https://meta.discourse.org/tags)，也用于各个标签。但现在，后者要求 URL 中使用 _ **tag** _，因此现有帖子中的所有链接都会跳转到 _ **哎呀！该页面不存在或为私密页面。** _ 页面。
  - 我在本 [表格](https://forums.crateentertainment.com/t/build-compendiums/82060/4) 中大量使用了此类链接。我本可以更新这些 URL，但这会重置点击计数器。
  - 纯属巧合，我今天注意到已设置了重定向，但该重定向仅在编辑器预览中有效，或者在地址栏中输入/编辑 URL 时才有效。因此，作为临时解决方案，用户需要刷新页面。

- 此外，“删除未使用的标签”功能似乎为空。然而，我们确实有一些已保留但未使用的标签。  
 ![grafik](https://global.discourse-cdn.com/meta/original/3X/d/9/d9c8ef9877890cc86304848268bed59486575150.png)

---

<div class="post-metadata">

### Author: ![eisprinzessin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eisprinzessin/32/234408_2.png) [@eisprinzessin](https://meta.discourse.org/u/eisprinzessin)
#### Post date: [2021 年9 月 23 日 16:02 UTC](https://meta.discourse.org/t/switch-from-tags-to-tag-broke-links-in-posts-and-delete-unused-tags/203892/2 "2021-09-23T16:02:54Z")

</div>

> [@eisprinzessin](#):
>
> 我在本 [表格](https://forums.crateentertainment.com/t/build-compendiums/82060/4) 中大量使用了此类链接。我本可以更新这些 URL，但这会重置点击计数器。

由于不清楚您将如何以及何时解决此问题，我已自行更新了表格中的标签链接，因为这给用户带来了不便。

以下是重定向错误的复现：[getting-started](https://meta.discourse.org/tags/getting-started)（按 F5 即可触发重定向）

* * *

对于 _删除未使用的标签_，我没有可用的变通方案。

---

<div class="post-metadata">

### Author: ![eisprinzessin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eisprinzessin/32/234408_2.png) [@eisprinzessin](https://meta.discourse.org/u/eisprinzessin)
#### Post date: [2021 年9 月 25 日 10:21 UTC](https://meta.discourse.org/t/switch-from-tags-to-tag-broke-links-in-posts-and-delete-unused-tags/203892/3 "2021-09-25T10:21:18Z")

</div>

> [@eisprinzessin](#):
>
> 对于“删除未使用的标签”，我没有变通方法。

不对。我们昨天已切换到“按组列出的标签”。作为副作用，未使用的标签会显示在其组的末尾。

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2022 年1 月 17 日 21:10 UTC](https://meta.discourse.org/t/switch-from-tags-to-tag-broke-links-in-posts-and-delete-unused-tags/203892/4 "2022-01-17T21:10:32Z")

</div>

这里有真正的 bug 吗 @tshenry？我看不出来。

---

<div class="post-metadata">

### Author: ![eisprinzessin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eisprinzessin/32/234408_2.png) [@eisprinzessin](https://meta.discourse.org/u/eisprinzessin)
#### Post date: [2022 年6 月 30 日 07:55 UTC](https://meta.discourse.org/t/switch-from-tags-to-tag-broke-links-in-posts-and-delete-unused-tags/203892/7 "2022-06-30T07:55:30Z")

</div>

错误/疏漏如下：

- 旧链接的重定向仅在在新标签页中打开链接时有效 - 这就是为什么它在编辑器中有效（参见我的 OP），因为您无法在编辑器的标签页中打开链接。
- **删除未使用的标签** 未列出任何未使用的标签。

_仅在 Firefox 中测试_

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2022 年6 月 30 日 07:59 UTC](https://meta.discourse.org/t/switch-from-tags-to-tag-broke-links-in-posts-and-delete-unused-tags/203892/8 "2022-06-30T07:59:37Z")

</div>

> [@eisprinzessin](#):
>
> 旧链接的重定向仅在您在新标签页中打开链接时才有效——这就是为什么它在撰写器中有效（参见我的原始帖子），因为您无法在撰写器的标签页中打开链接。

这至少可以通过在服务器上运行重映射任务来解决？

> [@Replace a string in all posts](https://meta.discourse.org/t/replace-a-string-in-all-posts/48729):
>
> bookmark This guide explains how to replace a string in all posts within a Discourse instance. person_raising_hand Required user level: System Administrator warning Console Access Required Want to replace a string in all the posts on a site? Let’s get started! warning WARNING: We strongly recommend you take a full backup before proceeding, and make sure your string replacement is specific enough to affect only the places you want it to. If this string replacement goes wrong, every…

> [@eisprinzessin](#):
>
> **删除未使用的标签** 未列出任何未使用的标签。

您能详细说明一下吗？是否有简单的重现步骤。当我在 meta 上运行此命令时，它确实列出了 8 个未使用的标签，所以一定有什么关于您找不到的标签的问题。

---

<div class="post-metadata">

### Author: ![eisprinzessin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eisprinzessin/32/234408_2.png) [@eisprinzessin](https://meta.discourse.org/u/eisprinzessin)
#### Post date: [2022 年6 月 30 日 09:18 UTC](https://meta.discourse.org/t/switch-from-tags-to-tag-broke-links-in-posts-and-delete-unused-tags/203892/10 "2022-06-30T09:18:40Z")

</div>

> [@sam](#):
>
> 这看起来至少可以通过在服务器上运行重新映射任务来解决？

我只是一个版主，无法访问我们的服务器。考虑到旧帖子中零星出现的几个实例，这可能不是我们管理员的优先事项。不过，我会建议一下。

> [@sam](#):
>
> 你能详细说明一下吗？是否有简单的重现方法？

从那以后它就没在我这里工作过，也许现在只对管理员有效了。

> [@sam](#):
>
> 当我在 meta 上运行它时，它确实列出了 8 个未使用的标签，所以有些东西是你的标签找不到。

如果不是权限问题，我们的管理员还能做些什么来解决这个问题？

---

<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: [2022 年7 月 9 日 06:59 UTC](https://meta.discourse.org/t/switch-from-tags-to-tag-broke-links-in-posts-and-delete-unused-tags/203892/12 "2022-07-09T06:59:38Z")

</div>

我认为现在应该已经解决了。🤞

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

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2022 年7 月 11 日 06:43 UTC](https://meta.discourse.org/t/switch-from-tags-to-tag-broke-links-in-posts-and-delete-unused-tags/203892/13 "2022-07-11T06:43:35Z")

</div>


