import type { Metadata } from "next"; import { WORK_ARTICLES } from "@/content/workArticles"; import { isPasscodeProtectedPath } from "@/lib/passcode"; import { getPasscodeAccessServer } from "@/lib/passcodeServer"; /** * Per-page : the original detail route sets <title> to the work name * (haoqi.design/reunimos → "Reunimos™"). The protected /2026 is gated on the * server — without the access cookie its SSR title is "Protected"; once * unlocked the server renders the article. We mirror both states. Lives in a * segment layout so `params` contains the slug for both /work/[slug] and its * root rewrite. */ export async function generateMetadata({ params, }: { params: Promise<{ slug: string }>; }): Promise<Metadata> { const { slug } = await params; const path = `/${slug}`; if (isPasscodeProtectedPath(path)) { const access = await getPasscodeAccessServer(); if (!access[path]) return { title: "受保护内容" }; } const article = WORK_ARTICLES[path]; return { title: article ? article.title : "北极新一©2026" }; } export default function WorkLayout({ children, }: Readonly<{ children: React.ReactNode }>) { return children; }