From 55edb66172f99d72ecfaa1f25d618b1727196d6c Mon Sep 17 00:00:00 2001 From: Cory Dransfeldt Date: Sat, 26 Oct 2024 17:13:29 -0700 Subject: [PATCH] =?UTF-8?q?fix:=20worker=20=E2=80=94=20prefer=20backdrop?= =?UTF-8?q?=20for=20og=20image=20if=20available?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- workers/dynamic-pages/utils/generators.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/workers/dynamic-pages/utils/generators.js b/workers/dynamic-pages/utils/generators.js index f394c33a..7ef6a29d 100644 --- a/workers/dynamic-pages/utils/generators.js +++ b/workers/dynamic-pages/utils/generators.js @@ -345,9 +345,7 @@ export const generateMetadata = (data, type, globals) => { const canonicalUrl = data["url"] ? `${globals["url"]}${data["url"]}` : globals["url"]; - const ogImage = `${globals["cdn_url"]}${ - data["image"] || globals["avatar"] - }?class=w800`; + const ogImage = `${globals["cdn_url"]}${(data["backdrop"] ? data["backdrop"] : data["image"]) || globals["avatar"]}?class=w800`; description = convert( truncateHtml(md.render(description), 100, { @@ -376,10 +374,10 @@ export const generateMetadata = (data, type, globals) => { title = `Genre / ${data["name"]} / ${globals["site_name"]}`; break; case "book": - title = `Books / ${data["title"]} by ${data.author} / ${globals["site_name"]}`; + title = `Books / ${data["title"]} by ${data["author"]} / ${globals["site_name"]}`; break; case "movie": - title = `Movies / ${data["title"]} (${data.year}) / ${globals["site_name"]}`; + title = `Movies / ${data["title"]} (${data["year"]}) / ${globals["site_name"]}`; break; case "show": title = `Shows / ${data["title"]} / ${globals["site_name"]}`;