From b7e752078c589dd75e2382504ec83032608cf8e2 Mon Sep 17 00:00:00 2001
From: Stephen Zhou <38493346+hyoban@users.noreply.github.com>
Date: Fri, 30 Jan 2026 17:30:24 +0800
Subject: [PATCH] fix: trigger doc link (#31754)
---
.../explore/sidebar/no-apps/index.tsx | 4 ++-
.../workflow/nodes/trigger-plugin/default.ts | 2 +-
.../nodes/trigger-schedule/default.ts | 2 +-
.../workflow/nodes/trigger-webhook/default.ts | 2 +-
.../workflow/utils/gen-node-meta-data.ts | 3 +-
web/context/i18n.ts | 32 +++++++++++--------
web/scripts/gen-doc-paths.ts | 9 ++++++
web/types/doc-paths.ts | 6 +++-
8 files changed, 40 insertions(+), 20 deletions(-)
diff --git a/web/app/components/explore/sidebar/no-apps/index.tsx b/web/app/components/explore/sidebar/no-apps/index.tsx
index 39b425ce35..f2f406008b 100644
--- a/web/app/components/explore/sidebar/no-apps/index.tsx
+++ b/web/app/components/explore/sidebar/no-apps/index.tsx
@@ -2,6 +2,7 @@
import type { FC } from 'react'
import * as React from 'react'
import { useTranslation } from 'react-i18next'
+import { useDocLink } from '@/context/i18n'
import useTheme from '@/hooks/use-theme'
import { Theme } from '@/types/app'
import { cn } from '@/utils/classnames'
@@ -12,12 +13,13 @@ const i18nPrefix = 'sidebar.noApps'
const NoApps: FC = () => {
const { t } = useTranslation()
const { theme } = useTheme()
+ const docLink = useDocLink()
return (
)
}
diff --git a/web/app/components/workflow/nodes/trigger-plugin/default.ts b/web/app/components/workflow/nodes/trigger-plugin/default.ts
index 0cb2a72c91..605a1e3f1d 100644
--- a/web/app/components/workflow/nodes/trigger-plugin/default.ts
+++ b/web/app/components/workflow/nodes/trigger-plugin/default.ts
@@ -221,7 +221,7 @@ const buildOutputVars = (schema: Record, schemaTypeDefinitions?: Sc
const metaData = genNodeMetaData({
sort: 1,
type: BlockEnum.TriggerPlugin,
- helpLinkUri: 'plugin-trigger',
+ helpLinkUri: 'trigger/plugin-trigger',
isStart: true,
})
diff --git a/web/app/components/workflow/nodes/trigger-schedule/default.ts b/web/app/components/workflow/nodes/trigger-schedule/default.ts
index 4f166675e7..587a125c2d 100644
--- a/web/app/components/workflow/nodes/trigger-schedule/default.ts
+++ b/web/app/components/workflow/nodes/trigger-schedule/default.ts
@@ -110,7 +110,7 @@ const validateVisualConfig = (payload: ScheduleTriggerNodeType, t: any): string
const metaData = genNodeMetaData({
sort: 2,
type: BlockEnum.TriggerSchedule,
- helpLinkUri: 'schedule-trigger',
+ helpLinkUri: 'trigger/schedule-trigger',
isStart: true,
})
diff --git a/web/app/components/workflow/nodes/trigger-webhook/default.ts b/web/app/components/workflow/nodes/trigger-webhook/default.ts
index ec0369d753..66fae30b0d 100644
--- a/web/app/components/workflow/nodes/trigger-webhook/default.ts
+++ b/web/app/components/workflow/nodes/trigger-webhook/default.ts
@@ -8,7 +8,7 @@ import { createWebhookRawVariable } from './utils/raw-variable'
const metaData = genNodeMetaData({
sort: 3,
type: BlockEnum.TriggerWebhook,
- helpLinkUri: 'webhook-trigger',
+ helpLinkUri: 'trigger/webhook-trigger',
isStart: true,
})
diff --git a/web/app/components/workflow/utils/gen-node-meta-data.ts b/web/app/components/workflow/utils/gen-node-meta-data.ts
index f45bfcb018..e625e3a8af 100644
--- a/web/app/components/workflow/utils/gen-node-meta-data.ts
+++ b/web/app/components/workflow/utils/gen-node-meta-data.ts
@@ -1,4 +1,5 @@
import type { BlockEnum } from '@/app/components/workflow/types'
+import type { UseDifyNodesPath } from '@/types/doc-paths'
import { BlockClassificationEnum } from '@/app/components/workflow/block-selector/types'
export type GenNodeMetaDataParams = {
@@ -7,7 +8,7 @@ export type GenNodeMetaDataParams = {
type: BlockEnum
title?: string
author?: string
- helpLinkUri?: string
+ helpLinkUri?: UseDifyNodesPath
isRequired?: boolean
isUndeletable?: boolean
isStart?: boolean
diff --git a/web/context/i18n.ts b/web/context/i18n.ts
index 2766dfe5ea..5f39d1afb3 100644
--- a/web/context/i18n.ts
+++ b/web/context/i18n.ts
@@ -1,6 +1,7 @@
import type { Locale } from '@/i18n-config/language'
import type { DocPathWithoutLang } from '@/types/doc-paths'
import { useTranslation } from '#i18n'
+import { useCallback } from 'react'
import { getDocLanguage, getLanguage, getPricingPageLanguage } from '@/i18n-config/language'
import { apiReferencePathTranslations } from '@/types/doc-paths'
@@ -27,21 +28,24 @@ export const useDocLink = (baseUrl?: string): ((path?: DocPathWithoutLang, pathM
let baseDocUrl = baseUrl || defaultDocBaseUrl
baseDocUrl = (baseDocUrl.endsWith('/')) ? baseDocUrl.slice(0, -1) : baseDocUrl
const locale = useLocale()
- const docLanguage = getDocLanguage(locale)
- return (path?: DocPathWithoutLang, pathMap?: DocPathMap): string => {
- const pathUrl = path || ''
- let targetPath = (pathMap) ? pathMap[locale] || pathUrl : pathUrl
- let languagePrefix = `/${docLanguage}`
+ return useCallback(
+ (path?: DocPathWithoutLang, pathMap?: DocPathMap): string => {
+ const docLanguage = getDocLanguage(locale)
+ const pathUrl = path || ''
+ let targetPath = (pathMap) ? pathMap[locale] || pathUrl : pathUrl
+ let languagePrefix = `/${docLanguage}`
- // Translate API reference paths for non-English locales
- if (targetPath.startsWith('/api-reference/') && docLanguage !== 'en') {
- const translatedPath = apiReferencePathTranslations[targetPath]?.[docLanguage as 'zh' | 'ja']
- if (translatedPath) {
- targetPath = translatedPath
- languagePrefix = ''
+ // Translate API reference paths for non-English locales
+ if (targetPath.startsWith('/api-reference/') && docLanguage !== 'en') {
+ const translatedPath = apiReferencePathTranslations[targetPath]?.[docLanguage as 'zh' | 'ja']
+ if (translatedPath) {
+ targetPath = translatedPath
+ languagePrefix = ''
+ }
}
- }
- return `${baseDocUrl}${languagePrefix}${targetPath}`
- }
+ return `${baseDocUrl}${languagePrefix}${targetPath}`
+ },
+ [baseDocUrl, locale],
+ )
}
diff --git a/web/scripts/gen-doc-paths.ts b/web/scripts/gen-doc-paths.ts
index f0393937c2..03c3cdaddc 100644
--- a/web/scripts/gen-doc-paths.ts
+++ b/web/scripts/gen-doc-paths.ts
@@ -282,6 +282,15 @@ function generateTypeDefinitions(
}
lines.push('')
+
+ // Add UseDifyNodesPath helper type after UseDifyPath
+ if (section === 'use-dify') {
+ lines.push('// UseDify node paths (without prefix)')
+ // eslint-disable-next-line no-template-curly-in-string
+ lines.push('type ExtractNodesPath = T extends `/use-dify/nodes/${infer Path}` ? Path : never')
+ lines.push('export type UseDifyNodesPath = ExtractNodesPath')
+ lines.push('')
+ }
}
// Generate API reference type (English paths only)
diff --git a/web/types/doc-paths.ts b/web/types/doc-paths.ts
index 7a74f0905d..8f95249354 100644
--- a/web/types/doc-paths.ts
+++ b/web/types/doc-paths.ts
@@ -2,7 +2,7 @@
// DON NOT EDIT IT MANUALLY
//
// Generated from: https://raw.githubusercontent.com/langgenius/dify-docs/refs/heads/main/docs.json
-// Generated at: 2026-01-21T07:24:02.413Z
+// Generated at: 2026-01-30T09:14:29.304Z
// Language prefixes
export type DocLanguage = 'en' | 'zh' | 'ja'
@@ -104,6 +104,10 @@ export type UseDifyPath =
| '/use-dify/workspace/subscription-management'
| '/use-dify/workspace/team-members-management'
+// UseDify node paths (without prefix)
+type ExtractNodesPath = T extends `/use-dify/nodes/${infer Path}` ? Path : never
+export type UseDifyNodesPath = ExtractNodesPath
+
// SelfHost paths
export type SelfHostPath =
| '/self-host/advanced-deployments/local-source-code'