feat: render CMS SEO metadata and refresh published page caches
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import { notFound } from "next/navigation";
|
||||
import type { Metadata } from "next";
|
||||
import { getSimpleContentPageBySlug } from "@/services/legal.service";
|
||||
import { createPageMetadata, getPageSEO } from "@/services/seo.service";
|
||||
import PageSEO from "@/components/layout/PageSEO";
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const page = await getSimpleContentPageBySlug("privacy-policy").catch(() => null);
|
||||
return { title: page?.title ?? "隐私政策" };
|
||||
return createPageMetadata(await getPageSEO("core.SimpleContentPage", "privacy-policy").catch(() => null), "隐私政策");
|
||||
}
|
||||
|
||||
export default async function PrivacyPolicyPage() {
|
||||
@@ -16,6 +17,7 @@ export default async function PrivacyPolicyPage() {
|
||||
|
||||
return (
|
||||
<article className="mx-auto max-w-3xl px-6 py-24">
|
||||
<PageSEO type="core.SimpleContentPage" slug="privacy-policy" />
|
||||
<h1 className="mb-8 text-4xl font-bold text-slate-900">{page.title}</h1>
|
||||
{/* page.body 为 Wagtail RichTextField 渲染出的 HTML,内容仅由后台编辑人员维护,非用户输入,可信任直接渲染 */}
|
||||
<div
|
||||
|
||||
Reference in New Issue
Block a user