fix: worker — prefer backdrop for og image if available

This commit is contained in:
Cory Dransfeldt 2024-10-26 17:13:29 -07:00
parent df699c8f67
commit 55edb66172
No known key found for this signature in database

View file

@ -345,9 +345,7 @@ export const generateMetadata = (data, type, globals) => {
const canonicalUrl = data["url"] const canonicalUrl = data["url"]
? `${globals["url"]}${data["url"]}` ? `${globals["url"]}${data["url"]}`
: globals["url"]; : globals["url"];
const ogImage = `${globals["cdn_url"]}${ const ogImage = `${globals["cdn_url"]}${(data["backdrop"] ? data["backdrop"] : data["image"]) || globals["avatar"]}?class=w800`;
data["image"] || globals["avatar"]
}?class=w800`;
description = convert( description = convert(
truncateHtml(md.render(description), 100, { truncateHtml(md.render(description), 100, {
@ -376,10 +374,10 @@ export const generateMetadata = (data, type, globals) => {
title = `Genre / ${data["name"]} / ${globals["site_name"]}`; title = `Genre / ${data["name"]} / ${globals["site_name"]}`;
break; break;
case "book": case "book":
title = `Books / ${data["title"]} by ${data.author} / ${globals["site_name"]}`; title = `Books / ${data["title"]} by ${data["author"]} / ${globals["site_name"]}`;
break; break;
case "movie": case "movie":
title = `Movies / ${data["title"]} (${data.year}) / ${globals["site_name"]}`; title = `Movies / ${data["title"]} (${data["year"]}) / ${globals["site_name"]}`;
break; break;
case "show": case "show":
title = `Shows / ${data["title"]} / ${globals["site_name"]}`; title = `Shows / ${data["title"]} / ${globals["site_name"]}`;