A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.
fix: link add nofollow
shuai68aa0f66bb8f
diff --git a/ui/src/components/Editor/utils/index.ts b/ui/src/components/Editor/utils/index.tsindex a617989b..ef36fa91 100644--- a/ui/src/components/Editor/utils/index.ts+++ b/ui/src/components/Editor/utils/index.ts@@ -141,4 +141,14 @@ export function htmlRender(el: HTMLElement | null) {table.parentNode?.replaceChild(div, table);div.appendChild(table);});++ // add rel nofollow for link not inlcludes domain+ el.querySelectorAll('a').forEach((a) => {+ if (a?.href?.includes('http')) return;+ const base = window.location.origin;+ const targetUrl = new URL(a.href, base);+ if (targetUrl.toString() !== window.location.href) {+ a.rel = 'nofollow';+ }+ });}