Skip to content

Commit

Permalink
feat: fix twitter tag to summary card
Browse files Browse the repository at this point in the history
  • Loading branch information
ridhozhr10 committed Jun 1, 2024
1 parent 9066f48 commit 5155150
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
10 changes: 10 additions & 0 deletions src/app/posts/[...path]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ export function generateMetadata({ params }: Props): Metadata {
images: `/img/smug-ico.png`,
type: "website",
},
twitter: {
card: "summary",
title: `${params.path.join("/")} Posts :: Ridho Azhar`,
images: [`/img/smug-ico.png`],
},
};
}

Expand All @@ -122,6 +127,11 @@ export function generateMetadata({ params }: Props): Metadata {
publishedTime: post.created_at,
modifiedTime: post.updated_at,
},
twitter: {
card: "summary",
title,
images: [post.ogImage.url],
},
};
}

Expand Down
9 changes: 7 additions & 2 deletions src/app/tags/[tag]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,16 @@ export function generateMetadata({ params }: Props): Metadata {
title,
robots: { follow: true, index: true },
openGraph: {
title: `title`,
title,
url: `/tags/${params.tag}`,
images: `/img/smug-ico.png`,
images: [`/img/smug-ico.png`],
type: "website",
},
twitter: {
card: "summary",
title,
images: [`/img/smug-ico.png`],
},
};
}
export function generateStaticParams() {
Expand Down
8 changes: 7 additions & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,14 @@ export const baseMetadata = (path: string, titlePrefix?: string): Metadata => {
title: `${titlePrefix || ""}${titlePrefix ? " :: " : ""}${title}`,
url: `${path ? "/" : ""}${path}`,
description: description,
images: `/img/smug-ico.png`,
images: [`/img/smug-ico.png`],
type: "website",
},
twitter: {
card: "summary",
description,
title: `${titlePrefix || ""}${titlePrefix ? " :: " : ""}${title}`,
images: [`/img/smug-ico.png`],
},
};
};

0 comments on commit 5155150

Please sign in to comment.