Skip to content

Commit b090c03

Browse files
committed
feat: add social media preview
1 parent 4e90003 commit b090c03

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/pages/posts/[slug].tsx

+10
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ const Post = (props: PostModel) => {
1919
<title>{props.title}</title>
2020
<meta name="description" content="my site" />
2121
<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" />
2232
</Head>
2333

2434
<article>

src/types/Post.ts

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { MDXRemoteSerializeResult } from 'next-mdx-remote';
22

33
export interface PostModel {
44
title: string
5+
description: string
56
date: Date
67
slug: string
78
source: MDXRemoteSerializeResult

0 commit comments

Comments
 (0)