Skip to content

Commit 27ea766

Browse files
author
Alexandros Coutsicos (Server)
committed
Fix small bug, when first paragraph no text
1 parent 0d3828c commit 27ea766

File tree

1 file changed

+4
-3
lines changed
  • next/app/(main)/beitrag/[date]/[postslug]

1 file changed

+4
-3
lines changed

next/app/(main)/beitrag/[date]/[postslug]/page.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,15 +136,16 @@ export async function generateMetadata(
136136
parent: ResolvingMetadata
137137
): Promise<Metadata> {
138138
const post = await getPost(params);
139-
// console.log("constent", post.content.content);
140139

141140
let description = post.short_description;
142141

143-
if (!description) {
142+
if (!description && post.content && post.content.content) {
144143
let paragraph = post.content.content.find(
145144
(item) => item.type === "paragraph"
146145
);
147-
description = paragraph.content.find((item) => item.type === "text").text;
146+
if (paragraph && paragraph.content) {
147+
description = paragraph.content.find((item) => item.type === "text").text;
148+
}
148149
}
149150

150151
// optionally access and extend (rather than replace) parent metadata

0 commit comments

Comments
 (0)