Add more openGraph metadata to files

This commit is contained in:
Lee 2022-11-17 07:16:44 +00:00
parent 4ccba7323d
commit c9d3e0f8f6
No known key found for this signature in database
GPG Key ID: 6EA25896ECCB3121

@ -50,13 +50,22 @@ export default function File({ isValidFile, fileData }) {
} }
} }
let openGraph = {
title: isValidFile ? `${fileId}.${ext}` : "Unknown file",
};
if (!isValidFile) {
openGraph.description = "This file was not found, is this correct id?";
}
if (imageOrVideo) {
openGraph = Object.assign(openGraph, imageOrVideo);
}
const metaData = ( const metaData = (
<NextSeo <NextSeo
title={isValidFile ? `${fileId}.${ext}` : "Invalid file"} title={isValidFile ? `${fileId}.${ext}` : "Invalid file"}
noindex noindex
openGraph={imageOrVideo} openGraph={openGraph}
twitter={{ twitter={{
cardType: "large_summary", cardType: isImage ? "summary_large_image" : isVideo ? "player" : null,
}} }}
/> />
); );