Skip to content

Commit

Permalink
Fix: Problem when rendering - 04-11 13:00
Browse files Browse the repository at this point in the history
  • Loading branch information
Yagasaki7K committed Nov 4, 2024
1 parent 815f576 commit 5989f09
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/pages/article/[slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,11 @@ export const getStaticProps: GetStaticProps = async ({ params }) => {
}

const renderedContent = marked(content);

return {
props: {
frontmatter,
slug,
content: renderedContent || "", // Garantindo que `content` seja uma string vazia se for `undefined`
content: renderedContent || "", // content sempre será uma string
},
};
};
Expand All @@ -69,7 +68,7 @@ export default function PostPage({ frontmatter, content = "" }: PostProps) {
}, [htmlContent]);

// Verificação detalhada para `frontmatter`
if (!frontmatter || !frontmatter.title || !frontmatter.excerpt || !frontmatter.date || !frontmatter.image) {
if (!frontmatter || !frontmatter.title || !frontmatter.excerpt || !frontmatter.date || !frontmatter.image || !htmlContent) {
return <p>Conteúdo não disponível</p>;
}

Expand Down

0 comments on commit 5989f09

Please sign in to comment.