Skip to content

Commit 1153609

Browse files
committed
update page meta
1 parent 561c4d1 commit 1153609

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

app/about/page.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
import type { Metadata } from 'next';
12
import Link from 'next/link';
23

4+
export const metadata: Metadata = {
5+
title: '关于',
6+
};
7+
38
export default function About() {
49
return (
510
<div className="mx-auto max-w-screen-lg px-8 py-10">

app/not-found.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1+
import type { Metadata } from 'next';
2+
13
import BackLink from '@/components/back-link';
24
import TypeAnimation from '@/components/type-animation';
35

6+
export const metadata: Metadata = {
7+
title: '404',
8+
};
9+
410
export default function NotFound() {
511
return (
612
<div className="mx-auto max-w-screen-lg px-8 py-10">

app/posts/[slug]/page.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
import { notFound } from 'next/navigation';
12
import { format } from 'date-fns';
23

34
import Markdown from '@/components/markdown';
5+
import BackLink from '@/components/back-link';
46
import { readingTime } from '@/lib/utils';
57
import client from '@/tina/__generated__/client';
6-
import BackLink from '@/components/back-link';
78

89
export const revalidate = 3600; // invalidate every hour
910

@@ -40,7 +41,13 @@ export default async function Post({
4041
params: Promise<{ slug: string }>;
4142
}) {
4243
const { slug } = await params;
43-
const { data } = await client.queries.post({ relativePath: `${slug}.mdx` });
44+
const { data, errors } = await client.queries.post({
45+
relativePath: `${slug}.mdx`,
46+
});
47+
48+
if (errors) {
49+
return notFound();
50+
}
4451

4552
return (
4653
<div className="mx-auto max-w-screen-lg px-8 py-10">

0 commit comments

Comments
 (0)