Skip to content

Commit f2f4574

Browse files
committed
Add OGP image
1 parent 3dfe0b0 commit f2f4574

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

src/components/seo.js

+20-14
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
import React from 'react'
2-
import PropTypes from 'prop-types'
3-
import Helmet from 'react-helmet'
4-
import { StaticQuery, graphql } from 'gatsby'
1+
import React from "react";
2+
import PropTypes from "prop-types";
3+
import Helmet from "react-helmet";
4+
import { StaticQuery, graphql } from "gatsby";
5+
6+
import ogImage from "../images/og-frame.png";
57

68
function SEO({ description, lang, meta, keywords, title }) {
79
return (
810
<StaticQuery
911
query={detailsQuery}
1012
render={data => {
1113
const metaDescription =
12-
description || data.site.siteMetadata.description
14+
description || data.site.siteMetadata.description;
1315
return (
1416
<Helmet
1517
htmlAttributes={{
@@ -50,6 +52,10 @@ function SEO({ description, lang, meta, keywords, title }) {
5052
name: `twitter:description`,
5153
content: metaDescription,
5254
},
55+
{
56+
name: `og:image`,
57+
content: `https://www.reactdecal.org${ogImage}`,
58+
},
5359
]
5460
.concat(
5561
keywords.length > 0
@@ -60,30 +66,30 @@ function SEO({ description, lang, meta, keywords, title }) {
6066
: []
6167
)
6268
.concat(meta)}
63-
>
64-
<link rel="stylesheet" href="https://use.typekit.net/ffz7vta.css" />
65-
</Helmet>
66-
)
69+
>
70+
<link rel="stylesheet" href="https://use.typekit.net/ffz7vta.css" />
71+
</Helmet>
72+
);
6773
}}
6874
/>
69-
)
75+
);
7076
}
7177

7278
SEO.defaultProps = {
7379
lang: `en`,
7480
meta: [],
7581
keywords: [],
76-
}
82+
};
7783

7884
SEO.propTypes = {
7985
description: PropTypes.string,
8086
lang: PropTypes.string,
8187
meta: PropTypes.array,
8288
keywords: PropTypes.arrayOf(PropTypes.string),
8389
title: PropTypes.string.isRequired,
84-
}
90+
};
8591

86-
export default SEO
92+
export default SEO;
8793

8894
const detailsQuery = graphql`
8995
query DefaultSEOQuery {
@@ -95,4 +101,4 @@ const detailsQuery = graphql`
95101
}
96102
}
97103
}
98-
`
104+
`;

src/images/og-frame.png

65.3 KB
Loading

0 commit comments

Comments
 (0)