diff --git a/apps/frontend/app/(with-header-footer)/blog/[id]/page.tsx b/apps/frontend/app/(with-header-footer)/blog/[id]/page.tsx index 30caff5..14235e0 100644 --- a/apps/frontend/app/(with-header-footer)/blog/[id]/page.tsx +++ b/apps/frontend/app/(with-header-footer)/blog/[id]/page.tsx @@ -14,6 +14,7 @@ import { Skeleton } from "@/components/ui/skeleton"; import { BlogComments } from "./components/BlogComments"; import Image from "next/image"; import { BlogAPI } from "@/lib/api/client"; +import { useEffect } from "react"; export default function Blog() { const params = useParams(); @@ -34,6 +35,16 @@ export default function Blog() { () => BlogAPI.getBlog(id, password || undefined), ) + useEffect(() => { + if (data) { + document.title = `${data.title} - 特恩的日志`; + const metaDescription = document.querySelector('meta[name="description"]'); + if (metaDescription) { + metaDescription.setAttribute("content", data.description); + } + } + }, [data]); + return (