feat: favicon, webmanifest, og-default, improved SEO metadata + twitter cards + canonical
This commit is contained in:
+12
-1
@@ -19,16 +19,27 @@ export async function generateMetadata({ params }) {
|
||||
const { slug } = await params;
|
||||
const article = await getArticle(slug);
|
||||
if (!article) return { title: 'Статья не найдена' };
|
||||
const ogImages = article.cover_url
|
||||
? [{ url: article.cover_url.startsWith('http') ? article.cover_url : `https://zeropost.ru${article.cover_url}`, width: 1600, height: 900, alt: article.title }]
|
||||
: [{ url: 'https://zeropost.ru/og-default.png', width: 1200, height: 630 }];
|
||||
return {
|
||||
title: article.seo_title || article.title,
|
||||
description: article.seo_descr || article.excerpt,
|
||||
alternates: { canonical: `https://zeropost.ru/blog/${slug}` },
|
||||
openGraph: {
|
||||
title: article.title,
|
||||
description: article.excerpt,
|
||||
type: 'article',
|
||||
url: `https://zeropost.ru/blog/${slug}`,
|
||||
publishedTime: article.published_at,
|
||||
tags: article.tags || [],
|
||||
images: article.cover_url ? [{ url: article.cover_url }] : undefined,
|
||||
images: ogImages,
|
||||
},
|
||||
twitter: {
|
||||
card: 'summary_large_image',
|
||||
title: article.seo_title || article.title,
|
||||
description: article.seo_descr || article.excerpt,
|
||||
images: ogImages.map(i => i.url),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user