import type { Metadata } from "next"; import { fetchLibraryList, type LibraryDocListItem } from "@/lib/api"; import { getPublicSettingsCached } from "@/lib/serverData"; import { requestCanonical } from "@/lib/canonicalMeta"; import { libraryPath } from "@/lib/urlStyle"; import LibrarySearchGrid from "@/components/LibrarySearchGrid"; export async function generateMetadata(): Promise { const settings = await getPublicSettingsCached(); return { title: "书库", description: settings.site_description, ...(await requestCanonical(libraryPath(settings.url_style))), }; } export default async function LibraryPage() { const settings = await getPublicSettingsCached(); // 接口失败降级为空态,不让页面 500 let docs: LibraryDocListItem[] = []; try { const res = await fetchLibraryList(); docs = res.docs ?? []; } catch { /* 降级空态 */ } return (
{/* Hero:书香气——serif 大标题、两侧晕染、底部水纹线 */}

Library

书库

书籍、文档与页面作品,在线阅读或下载

); }