Add more openGraph metadata to files
This commit is contained in:
parent
4ccba7323d
commit
c9d3e0f8f6
@ -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,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user