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

View file

@ -5,12 +5,20 @@ import Helmet from 'react-helmet';
import styled from 'styled-components'; import styled from 'styled-components';
import FavIcon from './FavIcon'; import FavIcon from './FavIcon';
function Header({ siteTitle }) { function Header({ siteTitle, siteDescription, siteUrl }) {
return ( return (
<HeaderWrapper className="header"> <HeaderWrapper className="header">
<FavIcon /> <FavIcon />
<Helmet> <Helmet>
<html lang="en" amp />
<title>{siteTitle}</title> <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> </Helmet>
<div> <div>
<h1> <h1>

View file

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