feat: connect company setup data and add about page
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import { notFound } from "next/navigation";
|
||||
import type { Metadata } from "next";
|
||||
import { getSimpleContentPageBySlug } from "@/services/legal.service";
|
||||
import { getPreviewOrFallback } from "@/services/preview.service";
|
||||
import { createPageMetadata, getPageSEO } from "@/services/seo.service";
|
||||
import PageSEO from "@/components/layout/PageSEO";
|
||||
import type { SimpleContentPageDetail } from "@/types/wagtail";
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
return createPageMetadata(await getPageSEO("core.SimpleContentPage", "about").catch(() => null), "关于我们");
|
||||
}
|
||||
|
||||
export default async function AboutPage() {
|
||||
const fallback = () => getSimpleContentPageBySlug("about").catch(() => null);
|
||||
const candidate = await getPreviewOrFallback<SimpleContentPageDetail>("core.simplecontentpage", "body", fallback);
|
||||
const page = candidate?.meta.slug === "about" ? candidate : await fallback();
|
||||
if (!page) notFound();
|
||||
|
||||
return (
|
||||
<article className="mx-auto max-w-3xl px-6 py-24">
|
||||
<PageSEO type="core.SimpleContentPage" slug="about" />
|
||||
<h1 className="mb-8 text-4xl font-bold text-slate-900">{page.title}</h1>
|
||||
<div
|
||||
className="space-y-4 text-slate-700 [&_h2]:mt-8 [&_h2]:text-2xl [&_h2]:font-semibold [&_h2]:text-slate-900 [&_ul]:list-disc [&_ul]:pl-6 [&_li]:mt-1"
|
||||
dangerouslySetInnerHTML={{ __html: page.body }}
|
||||
/>
|
||||
</article>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user