Skip to content

Commit

Permalink
fix: og:image
Browse files Browse the repository at this point in the history
  • Loading branch information
kalm42 committed Aug 2, 2020
1 parent 7c4509a commit e5abe35
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
4 changes: 3 additions & 1 deletion gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ module.exports = {
title: `Voice Your Stance`,
description: `The easiest way to find and contact your representatives about the issues that you care about.`,
author: `@kalm42`,
image: `src/images/social-card.png`,
url: `https://voiceyourstance.com`,
twitterUsername: `@VoiceYourStance`,
image: `/social-card.png`,
},
plugins: [
`gatsby-plugin-react-helmet`,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "voiceyourstance.com",
"version": "2.1.1",
"version": "2.1.2",
"author": "Kyle Melton <me@kylemelton.dev>",
"private": true,
"dependencies": {
Expand Down
14 changes: 11 additions & 3 deletions src/components/SEO.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import React from "react"
import PropTypes from "prop-types"
import { Helmet } from "react-helmet"
import { useStaticQuery, graphql } from "gatsby"
import { useLocation } from "@reach/router"

interface Props {
description?: string
Expand All @@ -19,6 +20,7 @@ interface Props {
}

function SEO(props: Props) {
const { pathname } = useLocation()
const {
description = "The easiest way to find and contact your elected representatives.",
lang = "en",
Expand All @@ -34,6 +36,8 @@ function SEO(props: Props) {
title
description
author
url
twitterUsername
image
}
}
Expand All @@ -48,9 +52,13 @@ function SEO(props: Props) {
name: `description`,
content: metaDescription,
},
{
property: `og:url`,
content: `${site.siteMetadata.url}${pathname}`,
},
{
property: `og:image`,
content: site.siteMetadata.image,
content: `${site.siteMetadata.url}${site.siteMetadata.image}`,
},
{
property: `og:title`,
Expand All @@ -66,11 +74,11 @@ function SEO(props: Props) {
},
{
name: `twitter:card`,
content: `summary`,
content: `summary_large_image`,
},
{
name: `twitter:creator`,
content: site.siteMetadata.author,
content: site.siteMetadata.twitterUsername,
},
{
name: `twitter:title`,
Expand Down
File renamed without changes

0 comments on commit e5abe35

Please sign in to comment.