# Clean Share URL – 用户可选择退出用户名归属

**URL:** <https://meta.discourse.org/t/clean-share-url-per-user-opt-out-of-username-attribution/409352>\
**Category:** Theme component\
**Created:** [2026年八月5日 09:04 UTC](https://meta.discourse.org/t/clean-share-url-per-user-opt-out-of-username-attribution/409352 "2026-08-05T09:04:28Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![scavin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/scavin/32/115938_2.png) [@scavin](https://meta.discourse.org/u/scavin)\
**Post date:** [2026年八月5日 09:04 UTC](https://meta.discourse.org/t/clean-share-url-per-user-opt-out-of-username-attribution/409352/1 "2026-08-05T09:04:28Z")

</div>

| | | |
| --- | --- | --- |
| ℹ | **摘要** | 允许用户从生成的分享链接中移除其用户名 |
| 🛠 | **仓库** | [https://github.com/scavin/discourse-clean-share-url](https://github.com/scavin/discourse-clean-share-url) |
| ❓ | **安装指南** | [如何安装主题或主题组件](https://meta.discourse.org/t/how-do-i-install-a-theme-or-theme-component/63682) |
| 📖 | **Discourse 主题新手？** | [Discourse 主题使用入门指南](https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966) |

安装此主题组件

Clean Share URL 在 **偏好设置 → 界面** 下添加了一个可选设置：

 ![CleanShot 2026-08-05 at 16.23.46@2x](https://global.discourse-cdn.com/meta/original/4X/e/8/0/e806d11d59eb231f3c8b5f686347e679b11c19b4.png)

> 在分享链接中隐藏我的用户名

默认情况下，Discourse 的行为保持不变：

```plaintext
/t/topic/123?u=username

```

当用户启用该偏好设置时，组件会移除 `u` 参数：

```plaintext
/t/topic/123

```

其他用户仍会正常收到分享归属及相关徽章进度。

## 配置

 ![CleanShot 2026-08-05 at 16.22.39@2x](https://global.discourse-cdn.com/meta/original/4X/c/3/2/c3239ac713d7d2210dc14da0c1da744a747a76ba.png)

在使用该组件之前，请创建一个可选的、可编辑的 **确认/复选框** 自定义用户字段。（`/admin/config/user-fields`）

在字段的编辑 URL 中找到其数字 ID，并将该数字输入到组件的 `clean_share_url` 设置中。

---

_[View the full topic](https://meta.discourse.org/t/clean-share-url-per-user-opt-out-of-username-attribution/409352)._
