Skip to content

Commit

Permalink
πŸ€” try ogimage
Browse files Browse the repository at this point in the history
  • Loading branch information
yuancong-liu committed Nov 19, 2023
1 parent fffd351 commit 238cdd3
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/app/blog/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ import styles from './index.module.scss';
export const metadata: Metadata = {
title: 'γ…‡γ…‡γ…Š',
description: 'γ…‡γ…‡γ…Š',
openGraph: {
title: 'γ…‡γ…‡γ…Š',
description: 'γ…‡γ…‡γ…Š',
type: 'website',
},
};

type Props = {
Expand All @@ -21,6 +26,20 @@ const PostPage = async ({ params }: Props) => {

const { post } = await getPost({ slug: params.slug });

metadata.openGraph = {
title: post.title,
type: 'website',
url: `${process.env.NEXT_PUBLIC_SITE_URL}${post.slug}`,
images: [
{
url: `${process.env.NEXT_PUBLIC_SITE_URL}/opengraph-image/`,
width: 1200,
height: 630,
alt: post.title,
},
],
};

const getDateString = (date: string) => {
const dateObj = new Date(date);
return `${dateObj.getFullYear()}/${dateObj.getMonth() + 1}/${
Expand Down

1 comment on commit 238cdd3

@vercel
Copy link

@vercel vercel bot commented on 238cdd3 Nov 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.