feat: render CMS SEO metadata and refresh published page caches

This commit is contained in:
2026-10-11 18:05:47 +08:00
parent a8e2863cc4
commit 870b9b4282
19 changed files with 310 additions and 35 deletions
+4 -2
View File
@@ -4,6 +4,8 @@ import { getSolutionBySlug } from "@/services/solution.service";
import { getPreviewOrFallback } from "@/services/preview.service";
import { BlockRenderer } from "@/blocks/BlockRenderer";
import type { SolutionPageDetail } from "@/types/wagtail";
import { createPageMetadata, getPageSEO } from "@/services/seo.service";
import PageSEO from "@/components/layout/PageSEO";
interface SolutionDetailPageProps {
params: Promise<{ slug: string }>;
@@ -13,8 +15,7 @@ export async function generateMetadata({
params,
}: SolutionDetailPageProps): Promise<Metadata> {
const { slug } = await params;
const solution = await getSolutionBySlug(slug).catch(() => null);
return { title: solution?.title ?? "解决方案未找到" };
return createPageMetadata(await getPageSEO("solutions.SolutionPage", slug).catch(() => null), "解决方案未找到");
}
export default async function SolutionDetailPage({
@@ -33,6 +34,7 @@ export default async function SolutionDetailPage({
return (
<article className="mx-auto max-w-3xl px-6 py-24">
<PageSEO type="solutions.SolutionPage" slug={slug} />
<h1 className="mb-2 text-4xl font-bold text-slate-900">
{solution.title}
</h1>
+6 -3
View File
@@ -1,16 +1,19 @@
import Link from "next/link";
import type { Metadata } from "next";
import { getSolutionList } from "@/services/solution.service";
import { createPageMetadata, getPageSEO } from "@/services/seo.service";
import PageSEO from "@/components/layout/PageSEO";
export const metadata: Metadata = {
title: "解决方案",
};
export async function generateMetadata(): Promise<Metadata> {
return createPageMetadata(await getPageSEO("solutions.SolutionIndexPage", "solutions").catch(() => null), "解决方案");
}
export default async function SolutionListPage() {
const solutions = await getSolutionList().catch(() => []);
return (
<div className="mx-auto max-w-4xl px-6 py-24">
<PageSEO type="solutions.SolutionIndexPage" slug="solutions" />
<h1 className="mb-12 text-4xl font-bold text-slate-900">解决方案</h1>
<ul className="space-y-6">
{solutions.map((solution) => (