fix: og image generation
This commit is contained in:
@@ -33,20 +33,19 @@ export async function generateMetadata({
|
||||
const sp = await searchParams;
|
||||
const bookCode = slugToBookCode(slug);
|
||||
|
||||
const quote = extractQuoteFromHl(sp);
|
||||
if (quote) {
|
||||
const meta = await getOtherDocumentMeta(bookCode);
|
||||
const content = await getOtherDocumentContent(bookCode, chapterSlug);
|
||||
const title = meta?.title ?? slug;
|
||||
const detail = content?.title ?? `Chapter ${chapterSlug}`;
|
||||
return buildOgMeta({ title, detail, quote });
|
||||
}
|
||||
|
||||
const [meta, content] = await Promise.all([
|
||||
getOtherDocumentMeta(bookCode),
|
||||
getOtherDocumentContent(bookCode, chapterSlug),
|
||||
]);
|
||||
|
||||
const paragraphs = content?.paragraphs;
|
||||
const quote = extractQuoteFromHl(sp, paragraphs);
|
||||
if (quote) {
|
||||
const title = meta?.title ?? slug;
|
||||
const detail = content?.title ?? `Chapter ${chapterSlug}`;
|
||||
return buildOgMeta({ title, detail, quote });
|
||||
}
|
||||
|
||||
return ogForOtherDocument(meta?.title ?? slug, content?.title ?? undefined);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user