Twitter Metadata
Unanswered
Bigeye tuna posted this in #help-forum
Bigeye tunaOP
why twitter metadata information not showing when i share url link to X (Twitter)? appear on other social media
8 Replies
Bigeye tunaOP
This is generateMetadata code
export async function generateMetadata({ params }) {
const { slug } = params;
const detailBerita = await fetchDetailBerita(slug);
const optimizedImage = detailBerita.gambar.replace(
/upload\//,
'upload/w_1200,h_630,c_fill,q_75/'
);
return {
title: detailBerita.judul,
openGraph: {
title: detailBerita.judul,
description: htmlToText(detailBerita.isi, {
wordwrap: 130,
limits: { maxInputLength: 1000 },
}),
siteName: APP_CONFIG.NAME,
publishedTime: new Date(detailBerita.created_at).toISOString(),
modifiedTime: new Date(detailBerita.updated_at).toISOString(),
images: [
{
url: optimizedImage,
width: 1200,
height: 630,
},
],
},
twitter: {
card: 'summary_large_image',
title: detailBerita.judul,
description: htmlToText(detailBerita.isi, {
wordwrap: 130,
limits: { maxInputLength: 1000 },
}),
images: [
{
url: optimizedImage,
alt: detailBerita.judul,
},
],
},
};
}
Are you using Vercel to publish it?
Usually it takes time for twitter cralwers to create a cache for the thumbnail preview
Bigeye tunaOP
no, i use my own domain
so, nothing wrong with my metadata code?
let me try
at a glance, no. You can check if its working or not by checking locally on local build if the requried meta tags are there