Skip to content

Commit

Permalink
用户发帖记录标签页标题显示用户名
Browse files Browse the repository at this point in the history
  • Loading branch information
wxh06 committed Jul 14, 2023
1 parent 0bd79b6 commit 29bbd19
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion packages/viewer/src/app/user/[uid]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,18 @@ import "@/components/markdown.css";
import TabNavigation from "./TabNavigation";
import UserStatistics from "./UserStatistics";

export const metadata = { title: "用户黑历史 - 洛谷帖子保存站" };
export async function generateMetadata({
params,
}: {
params: { uid: string };
}) {
const { username } =
(await prisma.user.findUnique({
select: { username: true },
where: { id: parseInt(params.uid, 10) },
})) ?? notFound();
return { title: `「${username}」的黑历史 - 洛谷帖子保存站` };
}

export default async function Layout({
children,
Expand Down

0 comments on commit 29bbd19

Please sign in to comment.