From c94d7409c8b1c33dbfb5d7156f60aff16cb98bcb Mon Sep 17 00:00:00 2001 From: Aleksander Helgaker Date: Sun, 25 Aug 2019 13:50:36 +0200 Subject: [PATCH] Fix linting errors. --- src/components/Layout/Layout.js | 9 +++++++-- src/templates/page-template.js | 3 ++- src/templates/post-template.js | 3 ++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/components/Layout/Layout.js b/src/components/Layout/Layout.js index b61e886..e01d749 100644 --- a/src/components/Layout/Layout.js +++ b/src/components/Layout/Layout.js @@ -13,7 +13,12 @@ type Props = { socialImage? :string }; -const Layout = ({ children, title, description, socialImage }: Props) => { +const Layout = ({ + children, + title, + description, + socialImage +}: Props) => { const { author, url } = useSiteMetadata(); const metaImage = socialImage != null ? socialImage : author.photo; const metaImageUrl = url + withPrefix(metaImage); @@ -32,7 +37,7 @@ const Layout = ({ children, title, description, socialImage }: Props) => { {children} - ) + ); }; export default Layout; diff --git a/src/templates/page-template.js b/src/templates/page-template.js index d959a15..4440f8c 100644 --- a/src/templates/page-template.js +++ b/src/templates/page-template.js @@ -16,7 +16,8 @@ type Props = { const PageTemplate = ({ data }: Props) => { const { title: siteTitle, subtitle: siteSubtitle } = useSiteMetadata(); const { html: pageBody } = data.markdownRemark; - const { title: pageTitle, description: pageDescription, socialImage } = data.markdownRemark.frontmatter; + const frontmatter = data.markdownRemark.frontmatter; + const { title: pageTitle, description: pageDescription, socialImage } = frontmatter; const metaDescription = pageDescription !== null ? pageDescription : siteSubtitle; return ( diff --git a/src/templates/post-template.js b/src/templates/post-template.js index 16a6ec9..3f3cb44 100644 --- a/src/templates/post-template.js +++ b/src/templates/post-template.js @@ -14,7 +14,8 @@ type Props = { const PostTemplate = ({ data }: Props) => { const { title: siteTitle, subtitle: siteSubtitle } = useSiteMetadata(); - const { title: postTitle, description: postDescription, socialImage } = data.markdownRemark.frontmatter; + const frontmatter = data.markdownRemark.frontmatter; + const { title: postTitle, description: postDescription, socialImage } = frontmatter; const metaDescription = postDescription !== null ? postDescription : siteSubtitle; return (