Sure thing @leerob , here’s my code:
export async function generateMetadata({ params }) {
let post = await getBlogData(`${params.slug}.mdx`)
if (!post) {
return
}
const { frontMatter: { title, date, author, thumbnailUrl, description, canonical, images } } = post;
return {
title,
description,
alternates: {
canonical,
},
openGraph: {
title,
description,
type: 'article',
publishedTime: date,
url: `https://www.kwrds.ai/blog/${params.slug}`,
images: [
{
url: `${thumbnailUrl}`,
},
],
},
twitter: {
card: 'summary_large_image',
title,
description,
images: [`${thumbnailUrl}`],
},
}
}
where thumbnailUrl
et.al. are loaded via mdx
:
---
title: 'How to Use Keyword Research for Effective Content Creation'
author: 'Fernando'
date: 'July 18, 2024'
description: "A Case Study for generating ideas around \"Android Studio\""
thumbnailUrl: "images/blog_assets/android_studio.png"
tags: ['Keyword Research', 'analysis','SERP API', 'PAA', 'SERP tracking' ]
canonical: "https://www.kwrds.ai/blog/keyword-research-case-study"
images:
- url: '/blog_assets/android_studio.png'
width: 800
height: 600
alt: 'How to Use Keyword Research for Effective Content Creation'
---
The current fix is to hardcode the thumbnailUrl
to contain the hostname ie:
export async function generateMetadata({ params }) {
let post = await getBlogData(`${params.slug}.mdx`)
if (!post) {
return
}
const { frontMatter: { title, date, author, thumbnailUrl, description, canonical, images } } = post;
return {
title,
description,
alternates: {
canonical,
},
openGraph: {
title,
description,
type: 'article',
publishedTime: date,
url: `https://www.kwrds.ai/blog/${params.slug}`,
images: [
{
url: `https://www.kwrds.ai/${thumbnailUrl}`,
},
],
},
twitter: {
card: 'summary_large_image',
title,
description,
images: [`https://www.kwrds.ai/${thumbnailUrl}`],
},
}
}
Without hostname
at the front, it will point to the internal deployment hash with Vercel origin.