From 52450a08fb2d64e8fdd2fe3dd6dfedb7308b7ab2 Mon Sep 17 00:00:00 2001 From: Bowen Liang Date: Mon, 9 Jun 2025 23:33:01 +0800 Subject: [PATCH] update useDocLink --- web/context/i18n.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/web/context/i18n.ts b/web/context/i18n.ts index 29081b2d58..8321e9e334 100644 --- a/web/context/i18n.ts +++ b/web/context/i18n.ts @@ -37,9 +37,10 @@ export const useGetPricingPageLanguage = () => { const defaultDocBaseUrl = 'https://docs.dify.ai' export const useDocLink = (baseUrl?: string): ((path?: string, pathMap?: { [index: string]: string }) => string) => { + let baseDocUrl = baseUrl || defaultDocBaseUrl + baseDocUrl = (baseDocUrl.endsWith('/')) ? baseDocUrl.slice(0, -1) : baseDocUrl const { locale } = useI18N() return (path?: string, pathMap?: { [index: string]: string }): string => { - const baseDocUrl = baseUrl || defaultDocBaseUrl const docLanguage = getDocLanguage(locale) const pathUrl = path || '' const targetPath = (pathMap) ? pathMap[locale] || pathUrl : pathUrl