Skip to content

Commit

Permalink
Fix: image
Browse files Browse the repository at this point in the history
  • Loading branch information
luciobenini committed May 20, 2020
1 parent e027acd commit 7a7625a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@pittica/gatsby-plugin-seo",
"private": false,
"description": "SEO optimization plugin for GatsbyJS.",
"version": "1.0.0",
"version": "1.0.1",
"author": {
"name": "Lucio Benini",
"email": "info@pittica.com",
Expand Down
13 changes: 10 additions & 3 deletions src/seo.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import PropTypes from "prop-types"
import { OpenGraph, TwitterCard, SchemaOrg } from "@pittica/gatsby-plugin-seo"

const SEO = ({ postData, frontmatter, image, isBlogPost, title, path }) => {
const { site } = useStaticQuery(
const { site, siteBuildMetadata } = useStaticQuery(
graphql`
query RemarkQuery {
query {
site {
siteMetadata {
title
Expand All @@ -24,6 +24,13 @@ const SEO = ({ postData, frontmatter, image, isBlogPost, title, path }) => {
}
}
}
siteBuildMetadata {
fields {
seo {
image
}
}
}
}
`
)
Expand All @@ -38,7 +45,7 @@ const SEO = ({ postData, frontmatter, image, isBlogPost, title, path }) => {
const description = postMeta.description || site.siteMetadata.description
const postImage = image
? `${siteUrl}/${image.replace(/^\//, "")}`
: `${siteUrl}/${site.siteMetadata.seo.image.replace(/^\//, "")}`
: `${siteUrl}/${siteBuildMetadata.fields.seo.image.replace(/^\//, "")}`
const url = `${siteUrl}${path}`
const datePublished = isBlogPost ? postMeta.datePublished : false

Expand Down

0 comments on commit 7a7625a

Please sign in to comment.