Skip to content

Commit

Permalink
Add basic twitter card
Browse files Browse the repository at this point in the history
Adds a basic twitter summary card using the same title, image, and
description as the open graph tags. Also improves the tag logic.
  • Loading branch information
psthomas committed Apr 19, 2020
1 parent bd1c4fc commit 61bf0de
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions static-site/src/components/SEO/SEO.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class SEO extends Component {
return (
<Helmet>
{/* General tags */}
<meta charset="utf-8" />
<meta name="description" content={description} />
<meta name="image" content={image} />

Expand All @@ -80,14 +81,23 @@ class SEO extends Component {

{/* OpenGraph tags */}
<meta property="og:url" content={postSEO ? postURL : blogURL} />
{postSEO ? <meta property="og:type" content="article" /> : null}
{postSEO ?
<meta property="og:type" content="article" /> :
<meta property="og:type" content="website" />
}
<meta property="og:title" content={title} />
<meta property="og:description" content={description} />
<meta property="og:image" content={image} />
<meta
property="fb:app_id"
content={config.siteFBAppID ? config.siteFBAppID : ""}
/>
{config.siteFBAppID ?
<meta property="fb:app_id" content={config.siteFBAppID} /> :
null
}

{/* Twitter Card tags */}
<meta name="twitter:card" content="summary" />
<meta name="twitter:title" content={title} />
<meta name="twitter:description" content={description} />
<meta name="twitter:image" content={image} />
</Helmet>
);
}
Expand Down

0 comments on commit 61bf0de

Please sign in to comment.