diff --git a/apps/website/app/[locale]/blog/components/BlogPostCard.tsx b/apps/website/app/[locale]/blog/components/BlogPostCard.tsx index 5fe5659..22f108d 100644 --- a/apps/website/app/[locale]/blog/components/BlogPostCard.tsx +++ b/apps/website/app/[locale]/blog/components/BlogPostCard.tsx @@ -3,13 +3,14 @@ import type { Post } from "@/lib/ghost"; import Image from "next/image"; import Link from "next/link"; - +import { useRouter } from "next/navigation"; interface BlogPostCardProps { post: Post; locale: string; } export function BlogPostCard({ post, locale }: BlogPostCardProps) { + const router = useRouter(); const formattedDate = new Date(post.published_at).toLocaleDateString(locale, { year: "numeric", month: "long", @@ -17,6 +18,9 @@ export function BlogPostCard({ post, locale }: BlogPostCardProps) { }); const handleTwitterClick = (e: React.MouseEvent) => { + if (post.primary_author?.twitter) { + router.push(`https://twitter.com/${post.primary_author.twitter}`); + } e.preventDefault(); e.stopPropagation(); }; @@ -29,7 +33,7 @@ export function BlogPostCard({ post, locale }: BlogPostCardProps) {
{post.feature_image {post.primary_author.twitter ? ( - - + ) : ( )} {post.primary_author?.twitter ? ( - {post.primary_author.name || "Unknown Author"} - + ) : ( {post.primary_author?.name || "Unknown Author"} )}