import type { Metadata } from 'next'; import { notFound } from 'next/navigation'; import { SupportedLocale } from 'components/layout/navbar/language-control'; import Prose from 'components/prose'; import { BLOG_HANDLE, HIDDEN_ARTICLE_TAG } from 'lib/constants'; import { getBlogArticle } from 'lib/shopify'; import { BlogArticle } from 'lib/shopify/types'; import Image from 'next/image'; export const runtime = 'edge'; export async function generateMetadata({ params }: { params: { handle: string; locale?: SupportedLocale }; }): Promise { const article: BlogArticle | undefined = await getBlogArticle({ handle: BLOG_HANDLE, articleHandle: params.handle, language: params?.locale?.toUpperCase() }); if (!article) return notFound(); const { url, width, height, altText: alt } = article.image || {}; const indexable = !article?.tags?.includes(HIDDEN_ARTICLE_TAG); return { title: article?.seo?.title || article?.title, description: article?.seo?.description || article?.excerpt, robots: { index: indexable, follow: indexable, googleBot: { index: indexable, follow: indexable } }, openGraph: url ? { images: [ { url, width, height, alt } ] } : null }; } export default async function BlogArticlePage({ params }: { params: { handle: string; locale?: SupportedLocale }; }) { const article: BlogArticle | undefined = await getBlogArticle({ handle: BLOG_HANDLE, articleHandle: params.handle, language: params?.locale?.toUpperCase() }); if (!article) return notFound(); return ( <>
{!!article?.image && (
{article?.image?.altText}
)}

{article.title}

); }