From c9d3e0f8f6cd08106187331b0f3cc2567c6680d9 Mon Sep 17 00:00:00 2001 From: Liam Date: Thu, 17 Nov 2022 07:16:44 +0000 Subject: [PATCH] Add more openGraph metadata to files --- src/pages/files/[fileId].js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/pages/files/[fileId].js b/src/pages/files/[fileId].js index 3673296..cf36b11 100644 --- a/src/pages/files/[fileId].js +++ b/src/pages/files/[fileId].js @@ -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 = ( );