feat(website): basic SEO
This commit is contained in:
9
packages/website/src/lib/useDocumentTitle.ts
Normal file
9
packages/website/src/lib/useDocumentTitle.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { useEffect } from 'react'
|
||||
|
||||
const DEFAULT_TITLE = 'PageAgent - The GUI Agent Living in Your Webpage'
|
||||
|
||||
export function useDocumentTitle(title?: string) {
|
||||
useEffect(() => {
|
||||
document.title = title ? `${title} - PageAgent` : DEFAULT_TITLE
|
||||
}, [title])
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import { Link, useLocation } from 'wouter'
|
||||
|
||||
import { SparklesText } from '@/components/ui/sparkles-text'
|
||||
import { useLanguage } from '@/i18n/context'
|
||||
import { useDocumentTitle } from '@/lib/useDocumentTitle'
|
||||
|
||||
interface DocsLayoutProps {
|
||||
children: ReactNode
|
||||
@@ -65,6 +66,12 @@ export default function DocsLayout({ children }: DocsLayoutProps) {
|
||||
},
|
||||
]
|
||||
|
||||
const activeTitle = navigationSections
|
||||
.flatMap((s) => s.items)
|
||||
.find((item) => item.path === location)?.title
|
||||
|
||||
useDocumentTitle(activeTitle)
|
||||
|
||||
return (
|
||||
<div className="max-w-7xl mx-auto px-6 py-8 overflow-x-auto">
|
||||
<div className="flex gap-8 min-w-225">
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { Suspense, lazy } from 'react'
|
||||
|
||||
import { useDocumentTitle } from '@/lib/useDocumentTitle'
|
||||
|
||||
import HeroSection from './HeroSection'
|
||||
|
||||
const FeaturesSection = lazy(() => import('./FeaturesSection'))
|
||||
@@ -7,6 +9,8 @@ const ScenariosSection = lazy(() => import('./ScenariosSection'))
|
||||
const OneMoreThingSection = lazy(() => import('./OneMoreThingSection'))
|
||||
|
||||
export default function HomePage() {
|
||||
useDocumentTitle()
|
||||
|
||||
return (
|
||||
<>
|
||||
<HeroSection />
|
||||
|
||||
Reference in New Issue
Block a user