Browse Source

Handle case when author does not exist

According to the Edge type in allMarkdownRemarkData, the author in
frontmatter could be undefined.

related to #24
main
tricinel 7 years ago
parent
commit
990a13e2af
  1. 4
      src/pages/blog/all.html.js

4
src/pages/blog/all.html.js

@ -76,6 +76,7 @@ const AllBlogPosts = ({data}: Props) => (
</Link> </Link>
</h2> </h2>
<MetaTitle>{node.fields.date}</MetaTitle> <MetaTitle>{node.fields.date}</MetaTitle>
{node.frontmatter.author ? (
<div <div
css={{ css={{
color: colors.subtle, color: colors.subtle,
@ -88,6 +89,9 @@ const AllBlogPosts = ({data}: Props) => (
</span> </span>
))} ))}
</div> </div>
) : (
<div />
)}
</li> </li>
))} ))}
</ul> </ul>

Loading…
Cancel
Save