import type { Metadata } from "next" import Link from "next/link" import { notFound } from "next/navigation" import { TrackedLink } from "@/components/ui/tracked-link" import { articleBySlug, articles } from "@/lib/articles" type ArticlePageProps = { params: Promise<{ slug: string }> } export const dynamic = "force-static" const socialImage = "/marketing/premiere-pro-mcp-social-square-v1.png" const articleDateFormatter = new Intl.DateTimeFormat("en-US", { day: "numeric", month: "long", timeZone: "UTC", year: "numeric", }) function formatArticleDate(date: string) { return articleDateFormatter.format(new Date(`${date}T00:00:00Z`)) } export function generateStaticParams() { return articles.map(({ slug }) => ({ slug })) } export async function generateMetadata({ params }: ArticlePageProps): Promise { const { slug } = await params const article = articleBySlug.get(slug) if (!article) { return {} } return { title: article.title, description: article.description, keywords: article.keywords, alternates: { canonical: `/blog/${article.slug}/` }, openGraph: { title: article.title, description: article.description, url: `/blog/${article.slug}/`, type: "article", publishedTime: article.publishedAt, modifiedTime: article.modifiedAt, authors: ["MCP for Adobe Premiere Pro contributors"], images: [{ url: socialImage, width: 1254, height: 1254, alt: "Premiere Pro MCP โ€” reviewable workflow automation" }], }, twitter: { card: "summary_large_image", title: article.title, description: article.description, images: [socialImage], }, } } export default async function ArticlePage({ params }: ArticlePageProps) { const { slug } = await params const article = articleBySlug.get(slug) if (!article) { notFound() } const relatedArticles = article.relatedSlugs ? article.relatedSlugs .map((relatedSlug) => articleBySlug.get(relatedSlug)) .filter((related): related is (typeof articles)[number] => Boolean(related)) : articles.filter((candidate) => candidate.slug !== article.slug).slice(0, 2) const articleUrl = `https://premiere-pro-mcp.com/blog/${article.slug}/` const structuredData = { "@context": "https://schema.org", "@graph": [ { "@type": "Article", "@id": `${articleUrl}#article`, headline: article.title, description: article.description, url: articleUrl, datePublished: article.publishedAt, dateModified: article.modifiedAt, inLanguage: "en-US", author: { "@type": "Organization", name: "MCP for Adobe Premiere Pro contributors", url: "https://github.com/leancoderkavy/premiere-pro-mcp", }, publisher: { "@id": "https://premiere-pro-mcp.com/#organization" }, mainEntityOfPage: articleUrl, keywords: article.keywords.join(", "), image: `https://premiere-pro-mcp.com${socialImage}`, }, { "@type": "FAQPage", "@id": `${articleUrl}#faq`, mainEntity: article.faqs.map((faq) => ({ "@type": "Question", name: faq.question, acceptedAnswer: { "@type": "Answer", text: faq.answer }, })), }, { "@type": "BreadcrumbList", "@id": `${articleUrl}#breadcrumb`, itemListElement: [ { "@type": "ListItem", position: 1, name: "MCP for Adobe Premiere Pro", item: "https://premiere-pro-mcp.com/" }, { "@type": "ListItem", position: 2, name: "Guides", item: "https://premiere-pro-mcp.com/blog/" }, { "@type": "ListItem", position: 3, name: article.title, item: articleUrl }, ], }, ], } return ( <>