Files
dify/web/hooks/use-document-title.ts
T
+8 d186daa131 E-300 (#19726)
Signed-off-by: -LAN- <[email protected]>
Co-authored-by: Hash Brown <[email protected]>
Co-authored-by: crazywoola <[email protected]>
Co-authored-by: GareArc <[email protected]>
Co-authored-by: Byron.wang <[email protected]>
Co-authored-by: Joel <[email protected]>
Co-authored-by: -LAN- <[email protected]>
Co-authored-by: Garfield Dai <[email protected]>
Co-authored-by: KVOJJJin <[email protected]>
Co-authored-by: Alexi.F <[email protected]>
Co-authored-by: Xiyuan Chen <[email protected]>
Co-authored-by: kautsar_masuara <[email protected]>
Co-authored-by: achmad-kautsar <[email protected]>
Co-authored-by: Xin Zhang <[email protected]>
Co-authored-by: kelvintsim <[email protected]>
Co-authored-by: zxhlyh <[email protected]>
Co-authored-by: Zixuan Cheng <[email protected]>
2025-05-20 12:07:50 +08:00

24 lines
729 B
TypeScript

'use client'
import { useGlobalPublicStore } from '@/context/global-public-context'
import { useFavicon, useTitle } from 'ahooks'
export default function useDocumentTitle(title: string) {
const isPending = useGlobalPublicStore(s => s.isPending)
const systemFeatures = useGlobalPublicStore(s => s.systemFeatures)
const prefix = title ? `${title} - ` : ''
let titleStr = ''
let favicon = ''
if (isPending === false) {
if (systemFeatures.branding.enabled) {
titleStr = `${prefix}${systemFeatures.branding.application_title}`
favicon = systemFeatures.branding.favicon
}
else {
titleStr = `${prefix}Dify`
favicon = '/favicon.ico'
}
}
useTitle(titleStr)
useFavicon(favicon)
}