@@ -12,7 +12,6 @@ const capitalize = (str) => {
1212 }
1313} ;
1414
15-
1615const ArticleMeta = ( { data, amp, location } ) => {
1716 const queryData = useStaticQuery ( graphql `
1817 query {
@@ -64,12 +63,12 @@ const ArticleMeta = ({ data, amp, location }) => {
6463 : null ;
6564
6665 const twitterImageUrl = feature_image
67- ? url . resolve ( config . siteUrl , feature_image )
68- : config . twitterCard . imageUrl
69- ? url . resolve ( config . siteUrl , config . twitterCard . imageUrl )
70- : config . coverUrl
71- ? url . resolve ( config . siteUrl , config . coverUrl )
72- : null ;
66+ ? url . resolve ( config . siteUrl , feature_image )
67+ : config . twitterCard . imageUrl
68+ ? url . resolve ( config . siteUrl , config . twitterCard . imageUrl )
69+ : config . coverUrl
70+ ? url . resolve ( config . siteUrl , config . coverUrl )
71+ : null ;
7372
7473 const author = data . author ;
7574 const publicTags = _ . map ( data . tags , ( tag ) => tag . name ) ;
@@ -94,12 +93,14 @@ const ArticleMeta = ({ data, amp, location }) => {
9493 const jsonLd = {
9594 "@context" : `https://schema.org/` ,
9695 "@type" : `Article` ,
97- author : author ? {
98- "@type" : `Person` ,
99- name : author . name ,
100- image : undefined ,
101- sameAs : undefined ,
102- } : null ,
96+ author : author
97+ ? {
98+ "@type" : `Person` ,
99+ name : author . name ,
100+ image : undefined ,
101+ sameAs : undefined ,
102+ }
103+ : null ,
103104 keywords : publicTags . length ? publicTags . join ( `, ` ) : undefined ,
104105 headline : data . plainTitle || config . siteTitle ,
105106 url : canonicalUrl ,
@@ -116,12 +117,14 @@ const ArticleMeta = ({ data, amp, location }) => {
116117 publisher : {
117118 "@type" : `Organization` ,
118119 name : config . siteTitle ,
119- logo : {
120- "@type" : `ImageObject` ,
121- url : publisherLogo ,
122- width : 60 ,
123- height : 60 ,
124- } ,
120+ logo : publisherLogo
121+ ? {
122+ "@type" : `ImageObject` ,
123+ url : publisherLogo ,
124+ width : 60 ,
125+ height : 60 ,
126+ }
127+ : undefined ,
125128 } ,
126129 description : data . plainExcerpt || config . siteDescription ,
127130 mainEntityOfPage : {
@@ -132,7 +135,7 @@ const ArticleMeta = ({ data, amp, location }) => {
132135
133136 return (
134137 < >
135- < Helmet htmlAttributes = { { lang :queryData . site . siteMetadata . language } } >
138+ < Helmet htmlAttributes = { { lang : queryData . site . siteMetadata . language } } >
136139 < title > { capitalize ( data . plainTitle ) } </ title >
137140 { ! amp && < link rel = "ampHtml" href = { `${ canonicalUrl } /amp` } /> }
138141 < meta name = "description" content = { data . plainExcerpt } />
@@ -180,8 +183,12 @@ const ArticleMeta = ({ data, amp, location }) => {
180183 { twitterImageUrl && (
181184 < meta name = "twitter:card" content = "summary_large_image" />
182185 ) }
183- { twitterImageUrl && < meta name = "twitter:image" content = { twitterImageUrl } /> }
184- { facebookImageUrl && < meta property = "og:image" content = { facebookImageUrl } /> }
186+ { twitterImageUrl && (
187+ < meta name = "twitter:image" content = { twitterImageUrl } />
188+ ) }
189+ { facebookImageUrl && (
190+ < meta property = "og:image" content = { facebookImageUrl } />
191+ ) }
185192 { config . twitterCard . username && (
186193 < meta name = "twitter:site" content = { config . twitterCard . username } />
187194 ) }
0 commit comments