Skip to content

Commit

Permalink
fix twitter meta tags
Browse files Browse the repository at this point in the history
  • Loading branch information
barbosa committed Feb 5, 2022
1 parent 5a75e0d commit b19c562
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/components/SEO.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import PropTypes from 'prop-types'
import Helmet from 'react-helmet'
import { useStaticQuery, graphql } from 'gatsby'

function SEO({ description, lang, meta, title }) {
function SEO({ lang, meta, title, excerpt }) {
const { site } = useStaticQuery(
graphql`
query {
Expand All @@ -25,7 +25,7 @@ function SEO({ description, lang, meta, title }) {
`
)

const metaDescription = description || site.siteMetadata.description
const metaDescription = excerpt || site.siteMetadata.description

return (
<Helmet
Expand Down Expand Up @@ -71,6 +71,10 @@ function SEO({ description, lang, meta, title }) {
name: `twitter:description`,
content: metaDescription,
},
{
name: `twitter:image`,
content: `https://raw.githubusercontent.com/loadsmart/blog/main/src/images/ls-logo-400px-transparent.png`,
},
].concat(meta)}
/>
)
Expand Down
4 changes: 2 additions & 2 deletions src/templates/blogTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ export default function Template({
data, // this prop will be injected by the GraphQL query below.
}) {
const { markdownRemark } = data // data.markdownRemark holds your post data
const { frontmatter, html, fields } = markdownRemark
const { frontmatter, html, excerpt, fields } = markdownRemark
const { readingTime } = fields

return (
<Layout>
<SEO title={frontmatter.title} />
<SEO title={frontmatter.title} excerpt={excerpt} />
<Section>
<PostWrapper>
<Title>{frontmatter.title}</Title>
Expand Down

0 comments on commit b19c562

Please sign in to comment.