28 lines
826 B
TypeScript
28 lines
826 B
TypeScript
import type { Metadata } from "next";
|
|
import { getHomePage } from "@/services/page.service";
|
|
import { BlockRenderer } from "@/blocks/BlockRenderer";
|
|
|
|
export const metadata: Metadata = {
|
|
title: "首页",
|
|
};
|
|
|
|
export default async function Home() {
|
|
const homePage = await getHomePage().catch(() => null);
|
|
|
|
if (!homePage) {
|
|
return (
|
|
<div className="mx-auto max-w-3xl px-6 py-32 text-center">
|
|
<h1 className="mb-4 text-3xl font-semibold text-slate-900">
|
|
尚未连接到 Wagtail CMS
|
|
</h1>
|
|
<p className="text-slate-600">
|
|
请确认后端服务已启动,并在 <code>.env.local</code> 中配置了{" "}
|
|
<code>NEXT_PUBLIC_API_URL</code>(默认 http://localhost:8000)。
|
|
</p>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
return <BlockRenderer blocks={homePage.body} />;
|
|
}
|