import type { Metadata } from "next"; import { cookies } from "next/headers"; import Link from "next/link"; import { Info } from "lucide-react"; import { fetchPublishedSitePages, fetchOverview, type SitePageSummary, } from "@/lib/api"; import { authCookieHeader } from "@/lib/cookies"; import { getMeCached, getPublicSettingsCached } from "@/lib/serverData"; import { isAdminOrAbove } from "@/lib/roles"; import { formatDate } from "@/lib/format"; import { pageGlyph } from "@/lib/pageGlyph"; import { SiteDocShell, SiteDocIdentity, SiteDocAnnoNav, } from "@/components/site-doc"; import { requestCanonical } from "@/lib/canonicalMeta"; import { pagePath, type UrlStyle } from "@/lib/urlStyle"; export async function generateMetadata(): Promise { return { title: "关于本站", description: "站点说明、政策与帮助文档", ...(await requestCanonical("/about")), }; } function PageRow({ p, showDivider, urlStyle, }: { p: SitePageSummary; showDivider: boolean; urlStyle: UrlStyle; }) { const Icon = pageGlyph(p.slug); return (

{p.title}

{p.excerpt ? (

{p.excerpt}

) : null}
); } export default async function AboutIndexPage() { const cookie = authCookieHeader(await cookies()); let pages: SitePageSummary[] = []; let error = ""; try { const res = await fetchPublishedSitePages(); pages = res.pages ?? []; } catch (e) { error = e instanceof Error ? e.message : "加载页面失败"; } const [overview, settings, me] = await Promise.all([ fetchOverview().catch(() => null), getPublicSettingsCached(), getMeCached(cookie || undefined), ]); const announcements = overview?.announcements ?? []; const siteLead = settings.site_description?.trim() || undefined; const urlStyle = settings.url_style; const canManagePages = !!me.user && isAdminOrAbove(me.user.role); const left = ; const right = ; return ( 0 ? : null } >

关于本站

{error ? "加载失败" : pages.length > 0 ? `共 ${pages.length} 篇站点文档` : "站点说明与政策文档"}

{canManagePages ? ( 管理 ) : null}
{error ? (

{error}

) : pages.length === 0 ? (

暂无介绍

有新文档时会显示在这里

) : ( pages.map((p, i) => 0} urlStyle={urlStyle} />) )}
); }