Skip to content

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 nofollow

shuai81d58431d5dd
diff --git a/ui/src/components/Customize/index.tsx b/ui/src/components/Customize/index.tsx
index 0570d19f..8f99cc05 100644
--- a/ui/src/components/Customize/index.tsx
+++ b/ui/src/components/Customize/index.tsx
@@ -32,7 +32,7 @@ const ActivateScriptNodes = (el, part) => {
scriptList.push(node);
}
}
- scriptList.forEach((so) => {
+ scriptList?.forEach((so) => {
const script = document.createElement('script');
script.text = so.text;
for (let i = 0; i < so.attributes.length; i += 1) {
diff --git a/ui/src/components/Editor/utils/index.ts b/ui/src/components/Editor/utils/index.ts
index 8bf393fb..7f8f80f6 100644
--- a/ui/src/components/Editor/utils/index.ts
+++ b/ui/src/components/Editor/utils/index.ts
@@ -146,7 +146,8 @@ export function htmlRender(el: HTMLElement | null) {
el.querySelectorAll('a').forEach((a) => {
const base = window.location.origin;
const targetUrl = new URL(a.href, base);
- if (targetUrl.toString() !== window.location.href) {
+
+ if (targetUrl.origin !== base) {
a.rel = 'nofollow';
}
});