{post.metadata.description}
) : null}import Link from "next/link"; import { getBlogRoute, normalizeTagSlug, type BlogPost } from "@/core/blog"; import { cn } from "@/lib/utils"; type PostListProps = { description?: string; posts: BlogPost[]; title: string; }; type PostMetaProps = { currentLang?: string; date?: string | null; languages?: string[]; pathname?: string; }; function formatDate(date?: string): string | null { if (!date) { return null; } const value = new Date(date); if (Number.isNaN(value.getTime())) { return date; } return new Intl.DateTimeFormat("en-US", { day: "numeric", month: "short", year: "numeric", }).format(value); } export function PostMeta({ currentLang, date, languages, pathname, }: PostMetaProps) { const formattedDate = formatDate(date ?? undefined); const availableLanguages = Array.isArray(languages) ? languages.filter((lang): lang is string => typeof lang === "string") : []; if (!formattedDate && availableLanguages.length <= 1) { return null; } return (
{formattedDate}
) : null} {pathname && availableLanguages.length > 1 ? ({description}
) : null}{post.metadata.description}
) : null}