Code in 2 snippets as its too long for 1 large box also removed some stuff as its too long
import ArticleDetails from './displayData';
export const generateMetadata = async ({ params }) => {
try {
const response = await fetch(`API_ENDPOINT`, {
method: 'POST',
credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ hash: params.hash }),
});
if (!response.ok) {
console.error(`Failed to fetch article data: ${response.status} - ${response.statusText}`);
return {
title: 'Page Not Found (404)',
description: 'Page Not Found (404)',
openGraph: {
title: 'Page Not Found (404)',
description: 'Page Not Found (404)',
images: [
{
url: 'https://cdn.glitch.global/21a2d050-b3c7-4611-8e67-c6f3ae33f0df/favicon.png?v=1720056814938',
width: 500,
height: 500,
alt: 'preview image',
},
],
url: 'https://website.com',
type: 'website',
},
twitter: {
card: 'summary_large_image',
title: 'Page Not Found (404)',
description: 'Page Not Found (404)',
images: [
'https://cdn.glitch.global/21a2d050-b3c7-4611-8e67-c6f3ae33f0df/favicon.png?v=1720056814938',
],
},
};
}
```js
const data = await response.json();
const entry = data.entry;
console.log(entry);
};