Skip to content

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

Merged
f2c-ci-robot[bot] merged 4 commits into
halo-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 into
halo-dev:mainfrom
HowieHz:refactor-chore-Use-rel=-noopener-ugc-on-user-links

Conversation

@HowieHz

@HowieHzHowieHz commented Mar 21, 2026

Copy link
Copy Markdown
Contributor

fix#214

  • + nofollow 优化 SEO
  • + 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

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-robotf2c-ci-robotBot 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
@HowieHzHowieHz changed the title pref: Use rel="noopener noreferrer nofollow ugc" on user linksfeat: Use rel="noopener noreferrer nofollow ugc" on user linksMar 21, 2026
@HowieHz

Copy link
Copy Markdown
ContributorAuthor

@JohnNiang 请求 review

Comment threadpackages/comment-widget/src/comment-editor.ts Outdated
Comment threadpackages/comment-widget/package.json Outdated
@HowieHz
HowieHz requested a review from ruibabyApril 6, 2026 19:51

@ruibabyruibaby left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/lgtm

@f2c-ci-robotf2c-ci-robotBot added the lgtm Indicates that a PR is ready to be merged. label Apr 7, 2026
@f2c-ci-robot

Copy link
Copy Markdown

[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-robotf2c-ci-robotBot 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-robotBot merged commit 61683b8 into halo-dev:mainApr 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 freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approvedIndicates a PR has been approved by an approver from all required OWNERS files.do-not-merge/release-note-label-neededIndicates that a PR should not merge because it's missing one of the release note labels.lgtmIndicates 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

@HowieHz@ruibaby