Skip to content

feat: Use rel="noopener noreferrer nofollow ugc" on user links#215

Merged
f2c-ci-robot[bot] merged 4 commits intohalo-dev:mainfrom
HowieHz:refactor-chore-Use-rel=-noopener-ugc-on-user-links
Apr 7, 2026
Merged

feat: Use rel="noopener noreferrer nofollow ugc" on user links#215
f2c-ci-robot[bot] merged 4 commits intohalo-dev:mainfrom
HowieHz:refactor-chore-Use-rel=-noopener-ugc-on-user-links

Conversation

@HowieHz
Copy link
Copy Markdown
Contributor

@HowieHz HowieHz commented Mar 21, 2026

fix #214

  • + ugc 符合最新语义(Google 自 2019)

我调查了下其他的

相关文档:


没有把链接的 target / rel 处理放进 packages/comment-widget/src/utils/html.ts 的 cleanHtml(),而是放在了渲染期 packages/comment-widget/src/comment-content.ts。

给评论正文里的 统一补 target="_blank" 和 rel="noopener noreferrer nofollow ugc" 作为渲染策略,区分于清洗逻辑。如果要在清洗的时候就做这个 rel 修改,有以下问题:

  • 首先数据库要额外保存 rel,要修改默认 sanitize-html 策略(附:sanitize-html 默认给 a 允许的是:href、name、target。)
  • 之前数据不带 rel 的已有数据,在渲染时也不能自带加上新 rel。

@f2c-ci-robot
Copy link
Copy Markdown

f2c-ci-robot bot commented Mar 21, 2026

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@f2c-ci-robot f2c-ci-robot bot added the do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. label Mar 21, 2026
@HowieHz HowieHz changed the title pref: Use rel="noopener noreferrer nofollow ugc" on user links feat: Use rel="noopener noreferrer nofollow ugc" on user links Mar 21, 2026
@HowieHz
Copy link
Copy Markdown
Contributor Author

HowieHz commented Apr 5, 2026

@JohnNiang 请求 review

@HowieHz HowieHz force-pushed the refactor-chore-Use-rel=-noopener-ugc-on-user-links branch 2 times, most recently from 3ec932e to 5d02526 Compare April 6, 2026 07:29
@HowieHz HowieHz requested a review from ruibaby April 6, 2026 19:51
Copy link
Copy Markdown
Member

@ruibaby ruibaby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@f2c-ci-robot f2c-ci-robot bot added the lgtm Indicates that a PR is ready to be merged. label Apr 7, 2026
@f2c-ci-robot
Copy link
Copy Markdown

f2c-ci-robot bot commented Apr 7, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ruibaby

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@f2c-ci-robot f2c-ci-robot bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 7, 2026
@f2c-ci-robot f2c-ci-robot bot merged commit 61683b8 into halo-dev:main Apr 7, 2026
2 checks passed
@HowieHz HowieHz deleted the refactor-chore-Use-rel=-noopener-ugc-on-user-links branch April 7, 2026 04:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

给评论区链接标记 rel="ugc"

2 participants