Merge pull request #281 from jreyes88/master

Added Twitter Card
This commit is contained in:
Wes Bos 2020-01-10 15:43:34 -05:00 committed by GitHub
commit ad2f2f8421
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 2 deletions

View file

@ -3,6 +3,7 @@ module.exports = {
title: `/uses`,
description: `A list of /uses pages detailing developer setups.`,
author: `@wesbos`,
siteUrl: "https://uses.tech",
},
plugins: [
{
@ -26,6 +27,7 @@ module.exports = {
icon: `src/images/gatsby-icon.png`, // This path is relative to the root of the site.
},
},
`gatsby-plugin-react-helmet`,
`gatsby-plugin-styled-components`,
],
};

View file

@ -5,12 +5,20 @@ import Helmet from 'react-helmet';
import styled from 'styled-components';
import FavIcon from './FavIcon';
function Header({ siteTitle }) {
function Header({ siteTitle, siteDescription, siteUrl }) {
return (
<HeaderWrapper className="header">
<FavIcon />
<Helmet>
<html lang="en" amp />
<title>{siteTitle}</title>
<meta name="description" content={siteDescription} />
<link rel="canonical" href={siteUrl} />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:creator" content="@wesbos" />
<meta name="twitter:title" content={siteTitle} />
<meta name="twitter:description" content={siteDescription} />
<meta name="twitter:image" content={`${siteUrl}/twitter-card.png`} />
</Helmet>
<div>
<h1>

View file

@ -19,6 +19,8 @@ const Layout = ({ children }) => {
site {
siteMetadata {
title
description
siteUrl
}
}
}
@ -28,7 +30,11 @@ const Layout = ({ children }) => {
<>
<GlobalStyle />
<Main>
<Header siteTitle={data.site.siteMetadata.title} />
<Header
siteTitle={data.site.siteMetadata.title}
siteDescription={data.site.siteMetadata.description}
siteUrl={data.site.siteMetadata.siteUrl}
/>
{children}
<footer>
<center ya-i-used-a-center-tag="sue me">

BIN
static/twitter-card.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 708 KiB