From 12358348cf0712ff708cb5f01ff413ec896a50a3 Mon Sep 17 00:00:00 2001 From: Kieran Date: Thu, 24 Feb 2022 13:15:56 +0000 Subject: [PATCH] Add open graph tags --- VoidCat/spa/src/FilePreview.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/VoidCat/spa/src/FilePreview.js b/VoidCat/spa/src/FilePreview.js index 41f2313..ab4b5ad 100644 --- a/VoidCat/spa/src/FilePreview.js +++ b/VoidCat/spa/src/FilePreview.js @@ -58,6 +58,29 @@ export function FilePreview() { return null; } + function renderOpenGraphTags() { + let tags = [ + , + , + , + + ]; + + const mime = info?.metadata?.mimeType; + if (mime?.startsWith("image/")) { + tags.push(); + tags.push(); + } else if (mime?.startsWith("video/")) { + tags.push(); + tags.push(); + } else if (mime?.startsWith("audio/")) { + tags.push(); + tags.push(); + } + + return tags; + } + useEffect(() => { loadInfo(); }, []); @@ -82,6 +105,7 @@ export function FilePreview() { void.cat - {info.metadata?.name} + {renderOpenGraphTags()} {info.metadata?.name ?? info.id} {renderTypes()}