Skip to content

Commit 620bbb1

Browse files
committed
feat: add more og meta tags
1 parent b090c03 commit 620bbb1

File tree

2 files changed

+41
-29
lines changed

2 files changed

+41
-29
lines changed

src/pages/index.tsx

+32-18
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,44 @@
1-
import type { GetStaticProps } from 'next';
2-
import type { PostPreview } from '../types/PostPreview';
3-
import Head from 'next/head';
4-
import Preview from '../components/Preview';
5-
import postList from '../lib/getPosts';
1+
import type { GetStaticProps } from "next";
2+
import type { PostPreview } from "../types/PostPreview";
3+
import Head from "next/head";
4+
import Preview from "../components/Preview";
5+
import postList from "../lib/getPosts";
66

77
const Home = (postList: { posts: [PostPreview] }) => {
88
return (
99
<>
1010
<Head>
1111
<title>wb&#39;s blog</title>
1212
<meta name="description" content="my site" />
13+
<link rel="icon" href="favicon.ico" />
14+
<link rel="shortcut icon" href="favicon.ico" />
15+
<meta property="og:title" content="wrongbyte.github.io" />
16+
<meta property="og:description" content="my random tech stuff" />
17+
<meta
18+
property="og:image"
19+
content="https://pbs.twimg.com/media/FMfaMdVUYAAtgp2?format=jpg&name=large"
20+
/>
21+
<meta name="twitter:title" content="wrongbyte.github.io" />
22+
<meta name="twitter:description" content="my random tech stuff" />
23+
<meta
24+
name="twitter:image"
25+
content="https://pbs.twimg.com/media/FMfaMdVUYAAtgp2?format=jpg&name=large"
26+
/>
1327
</Head>
1428
<section>
1529
{postList.posts.map((post) => (
1630
<Preview
17-
key={post.title}
18-
description={post.description}
19-
title={post.title}
20-
date={post.date}
21-
slug={post.slug}
31+
key={post.title}
32+
description={post.description}
33+
title={post.title}
34+
date={post.date}
35+
slug={post.slug}
2236
/>
2337
))}
2438
</section>
2539
</>
26-
)
27-
}
40+
);
41+
};
2842

2943
export const getStaticProps: GetStaticProps = async (context) => {
3044
return {
@@ -33,10 +47,10 @@ export const getStaticProps: GetStaticProps = async (context) => {
3347
title: post.title,
3448
description: post.description,
3549
date: post.date.toDateString(),
36-
slug: post.slug
37-
}))
38-
}
39-
}
40-
}
50+
slug: post.slug,
51+
})),
52+
},
53+
};
54+
};
4155

42-
export default Home
56+
export default Home;

src/pages/posts/[slug].tsx

+9-11
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,15 @@ const Post = (props: PostModel) => {
1818
<Head>
1919
<title>{props.title}</title>
2020
<meta name="description" content="my site" />
21-
<link rel="shortcut icon" href="favicon.ico" />
22-
<meta
23-
property="og:title"
24-
content={props.title}
25-
/>
26-
<meta name="twitter:card" content="summary" />
27-
<meta
28-
property="og:description"
29-
content={props.description}
30-
/>
31-
<meta property="og:image" content="https://pbs.twimg.com/media/FMfaMdVUYAAtgp2?format=jpg&name=large" />
21+
<link rel="icon" href="favicon.ico"/>
22+
<link rel="shortcut icon" href="favicon.ico"/>
23+
<meta property="og:title" content={props.title}/>
24+
<meta property="og:description" content={props.description}/>
25+
<meta property="og:image" content="https://pbs.twimg.com/media/FMfaMdVUYAAtgp2?format=jpg&name=large"/>
26+
<meta name="twitter:card" content={props.description}/>
27+
<meta name="twitter:title" content={props.title}/>
28+
<meta name="twitter:description" content={props.description}/>
29+
<meta name="twitter:image" content="https://pbs.twimg.com/media/FMfaMdVUYAAtgp2?format=jpg&name=large"/>
3230
</Head>
3331

3432
<article>

0 commit comments

Comments
 (0)