mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-23 12:13:11 +00:00
Handle case when author does not exist
According to the Edge type in allMarkdownRemarkData, the author in frontmatter could be undefined. related to #24
This commit is contained in:
@@ -76,18 +76,22 @@ const AllBlogPosts = ({data}: Props) => (
|
||||
</Link>
|
||||
</h2>
|
||||
<MetaTitle>{node.fields.date}</MetaTitle>
|
||||
<div
|
||||
css={{
|
||||
color: colors.subtle,
|
||||
marginTop: -5,
|
||||
}}>
|
||||
by{' '}
|
||||
{toCommaSeparatedList(node.frontmatter.author, author => (
|
||||
<span key={author.frontmatter.name}>
|
||||
{author.frontmatter.name}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
{node.frontmatter.author ? (
|
||||
<div
|
||||
css={{
|
||||
color: colors.subtle,
|
||||
marginTop: -5,
|
||||
}}>
|
||||
by{' '}
|
||||
{toCommaSeparatedList(node.frontmatter.author, author => (
|
||||
<span key={author.frontmatter.name}>
|
||||
{author.frontmatter.name}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<div />
|
||||
)}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
Reference in New Issue
Block a user