Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e09799c

Browse files
author
Carms Ng
committed
[ADD] og image & url meta tag
1 parent eb84142 commit e09799c

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

gatsby-config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ module.exports = {
44
title: 'Coderbunker Canada',
55
author: '@Carms-dev',
66
description: 'Coderbunker est une communauté internationale de passionnés de développement logiciel. Nous fonctionnons sur une base de budget d\'ingénierie mensuels prépayés sur lesquels nous recrutons des équipes formées de talents flexibles qui participent activement dans la construction d\'une communauté qui les rends heureux.',
7+
siteUrl: 'https://www.coderbunker.ca/',
78
},
89
plugins: [
910
'gatsby-transformer-json',

src/components/Seo.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ import React from 'react';
22
import PropTypes from 'prop-types';
33
import { Helmet } from 'react-helmet';
44
import { useStaticQuery, graphql } from 'gatsby';
5+
import siteOg from '../assets/images/coderbunker-og.png';
56

67
function Seo({
7-
description, lang, meta, title,
8+
description, lang, meta, title, image,
89
}) {
910
const { site } = useStaticQuery(
1011
graphql`
@@ -14,6 +15,7 @@ function Seo({
1415
title
1516
description
1617
author
18+
siteUrl
1719
}
1820
}
1921
}
@@ -22,6 +24,7 @@ function Seo({
2224

2325
const metaDescription = description || site.siteMetadata.description;
2426
const defaultTitle = site.siteMetadata?.title;
27+
const ogImage = image || siteOg;
2528

2629
return (
2730
<Helmet
@@ -43,6 +46,14 @@ function Seo({
4346
property: 'og:description',
4447
content: metaDescription,
4548
},
49+
{
50+
property: 'og:image',
51+
content: `${site.siteMetadata.siteUrl}${ogImage}`,
52+
},
53+
{
54+
property: 'og:url',
55+
content: `${site.siteMetadata.siteUrl}`,
56+
},
4657
{
4758
property: 'og:type',
4859
content: 'website',
@@ -72,7 +83,6 @@ Seo.defaultProps = {
7283
lang: 'en',
7384
meta: [],
7485
description: '',
75-
author: '',
7686
};
7787

7888
Seo.propTypes = {

0 commit comments

Comments
 (0)