Skip to content

Commit

Permalink
fix: make avatar optional in AuthorSnippet
Browse files Browse the repository at this point in the history
  • Loading branch information
konstantinmuenster committed Jan 23, 2023
1 parent 138a6b4 commit c9f47c5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ export function AuthorSnippet(): React.ReactElement {
const { author, avatar, bio } = useSiteMetadata();
return (
<div className={classes.AuthorSnippet}>
<GatsbyImage image={avatar.childImageSharp.gatsbyImageData} alt={author} className={classes.Avatar} />
{avatar?.childImageSharp?.gatsbyImageData ? (
<GatsbyImage image={avatar.childImageSharp.gatsbyImageData} alt={author} className={classes.Avatar} />
) : null}
<div className={classes.Description}>
<span className={classes.WrittenBy}>
Written By <u>{author}</u>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface SiteMetadata {
titleTemplate: string;
description: string;
author: string;
avatar: { childImageSharp: { gatsbyImageData: IGatsbyImageData } };
avatar?: { childImageSharp?: { gatsbyImageData?: IGatsbyImageData } };
bio: string;
social: {
[profile in SocialProfile]: string;
Expand Down

0 comments on commit c9f47c5

Please sign in to comment.