import type { Route } from "./+types/products.$id";
export function meta({ data }: Route.MetaArgs) {
const { product } = data;
const url = `https://example.com/products/${product.id}`;
return [
// Page title (50-60 characters)
{ title: `${product.name} - Buy Online | Store Name` },
// Meta description (150-160 characters)
{
name: "description",
content: `${product.description.substring(0, 155)}...`,
},
// Canonical URL
{ tagName: "link", rel: "canonical", href: url },
// Open Graph
{ property: "og:title", content: product.name },
{ property: "og:description", content: product.description },
{ property: "og:image", content: product.image },
{ property: "og:url", content: url },
{ property: "og:type", content: "product" },
// Twitter Card
{ name: "twitter:card", content: "summary_large_image" },
{ name: "twitter:title", content: product.name },
{ name: "twitter:description", content: product.description },
{ name: "twitter:image", content: product.image },
// Additional meta tags
{ name: "robots", content: "index, follow" },
{ name: "googlebot", content: "index, follow" },
];
}