Last active
September 30, 2021 11:57
-
-
Save dipanjanpanja6/0391e1c4a9b67e1985fcc08b01825a58 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react" | |
import { Helmet } from "react-helmet" | |
import { siteMetadata } from "../config/sitemetadata" | |
const SEO = ({ title = ``, description = ``, pathname = ``, image = ``, children = null }) => { | |
const { siteTitle, siteTitleAlt: defaultTitle, siteUrl, siteDescription: defaultDescription, siteLanguage, siteImage: defaultImage, author } = siteMetadata | |
const seo = { | |
title: title || defaultTitle, | |
description: description || defaultDescription, | |
url: `${siteUrl}${pathname || ``}`, | |
image: `${image || siteUrl + defaultImage}`, | |
} | |
return ( | |
<Helmet title={title} defaultTitle={defaultTitle} titleTemplate={`%s | ${siteTitle}`}> | |
<html lang={siteLanguage} /> | |
<meta name="description" content={seo.description} /> | |
<meta name="image" content={seo.image} /> | |
<meta property="og:title" content={seo.title} /> | |
<meta property="og:url" content={seo.url} /> | |
<meta property="og:description" content={seo.description} /> | |
<meta property="og:image" content={seo.image} /> | |
<meta property="og:type" content="website" /> | |
<meta property="og:image:alt" content={seo.description} /> | |
<meta name="twitter:card" content="summary_large_image" /> | |
<meta name="twitter:title" content={seo.title} /> | |
<meta name="twitter:url" content={seo.url} /> | |
<meta name="twitter:description" content={seo.description} /> | |
<meta name="twitter:image" content={seo.image} /> | |
<meta name="twitter:image:alt" content={seo.description} /> | |
<meta name="twitter:creator" content={author} /> | |
{children} | |
</Helmet> | |
) | |
} | |
export default SEO |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
siteMetadata: { | |
siteTitle: ``, | |
siteTitleAlt: ``, | |
siteHeadline: ``, | |
siteUrl: ``, | |
siteDescription: ``, | |
siteLanguage: `en`, | |
siteImage: `/logo512.png`, | |
author: ``, | |
social: [ | |
{ | |
name: "twitter", | |
url: "https://twitter.com/", | |
}, | |
{ | |
name: "linkedin", | |
url: "https://www.linkedin.com/company/", | |
}, | |
{ | |
name: "facebook", | |
url: "https://www.facebook.com/", | |
}, | |
{ | |
name: "instagram", | |
url: "https://www.instagram.com/", | |
}, | |
{ | |
name: "youtube", | |
url: "https://www.youtube.com/channel/", | |
}, | |
], | |
}, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment