meta data not working
Answered
CHEEMDA MAN posted this in #help-forum
export function generateImageMetadata({ params }) {
const { itinerarytype, itineraryname } = params;
// Map itinerary type to JSON key
const itineraryTypeMap = {
"indian-itinerary": "indian",
"foreign-itinerary": "foreign",
};
// Get the correct key for the itinerary type
const jsonKey = itineraryTypeMap[itinerarytype];
const data = jsonKey ? itinerariesData[jsonKey] : null;
// Normalize itinerary name for comparison
const normalizedItineraryName = itineraryname.toUpperCase().trim();
const itinerary = data
? data.find((item) => {
const normalizedTitle = item.title.toUpperCase().trim();
return normalizedTitle.includes(normalizedItineraryName);
})
: null;
const { title, description, image } = itinerary;
return {
title: title,
description: description,
openGraph: {
images: image,
},
}
}
i'm doing this to get meta data but the meta data not appearing is i'm doing something wrong?
const { itinerarytype, itineraryname } = params;
// Map itinerary type to JSON key
const itineraryTypeMap = {
"indian-itinerary": "indian",
"foreign-itinerary": "foreign",
};
// Get the correct key for the itinerary type
const jsonKey = itineraryTypeMap[itinerarytype];
const data = jsonKey ? itinerariesData[jsonKey] : null;
// Normalize itinerary name for comparison
const normalizedItineraryName = itineraryname.toUpperCase().trim();
const itinerary = data
? data.find((item) => {
const normalizedTitle = item.title.toUpperCase().trim();
return normalizedTitle.includes(normalizedItineraryName);
})
: null;
const { title, description, image } = itinerary;
return {
title: title,
description: description,
openGraph: {
images: image,
},
}
}
i'm doing this to get meta data but the meta data not appearing is i'm doing something wrong?
Answered by Sun bear
Different problem 😅
You could check this:
https://fabian-rosenthal.com/en/blog/fix-whatsapp-is-not-showing-the-open-graph-image
Maybe image size is the problem
You could check this:
https://fabian-rosenthal.com/en/blog/fix-whatsapp-is-not-showing-the-open-graph-image
Maybe image size is the problem
8 Replies
Sun bear
Try
generateMetadata
instead of generateImageMetadata
then it should workthanks bro working now
bro working but issue is some apps like on whatsapp the image of meta data not appearing but some apps like discord and telegram the image is appearing
Sun bear
Different problem 😅
You could check this:
https://fabian-rosenthal.com/en/blog/fix-whatsapp-is-not-showing-the-open-graph-image
Maybe image size is the problem
You could check this:
https://fabian-rosenthal.com/en/blog/fix-whatsapp-is-not-showing-the-open-graph-image
Maybe image size is the problem
Answer
ah. okay and thankyou for the reffence of solution too