quotes

My favourite quotes. (gatsbyjs)
git clone http://git.hanabi.in/repos/quotes.git
Log | Files | Refs | README | LICENSE

commit 0d98f6ab46c60658622a9d9a001d7482c0eeb966
parent 51af122a8f79f39dcc9a7739cb77e03a5d0b26a4
Author: Agastya Chandrakant <acagastya@outlook.com>
Date:   Sun, 26 Jul 2020 10:48:27 +0530

og:image

Diffstat:
Msrc/components/seo.js | 11++++++-----
Msrc/templates/blogPost.js | 4+++-
2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/components/seo.js b/src/components/seo.js @@ -11,7 +11,7 @@ import PropTypes from 'prop-types'; import Helmet from 'react-helmet'; import { useStaticQuery, graphql } from 'gatsby'; -function SEO({ blog = false, description, lang, path, tags, title }) { +function SEO({ blog = false, cover = 'https://upload.wikimedia.org/wikipedia/commons/6/68/Das_gro├če_Q.jpg', description, lang, path, tags, title }) { const { site } = useStaticQuery( graphql` query { @@ -44,14 +44,15 @@ function SEO({ blog = false, description, lang, path, tags, title }) { <meta property="og:type" content={type} /> <meta property="og:title" content={title} /> <meta property="og:description" content={metaDescription} /> + <meta property="og:image" content={cover} /> {blog && path ? ( <meta property="og:url" content={`${site.siteMetadata.siteUrl}/quote${path}`} /> ) : ( - <meta property="og:url" content={`${site.siteMetadata.siteUrl}`} /> - )} + <meta property="og:url" content={`${site.siteMetadata.siteUrl}`} /> + )} {blog && tags.length && tags.map(tag => ( @@ -65,8 +66,8 @@ function SEO({ blog = false, description, lang, path, tags, title }) { content={`${site.siteMetadata.siteUrl}/quote${path}`} /> ) : ( - <meta name="twitter:url" content={`${site.siteMetadata.siteUrl}`} /> - )} + <meta name="twitter:url" content={`${site.siteMetadata.siteUrl}`} /> + )} {blog && <meta name="twitter:label1" content="Written by" />} {blog && <meta name="twitter:data1" content={site.siteMetadata.author} />} {blog && tags.length && ( diff --git a/src/templates/blogPost.js b/src/templates/blogPost.js @@ -13,6 +13,7 @@ function Template({ data }) { const { attributed, author, + cover, lang = 'en', misattributed, path, @@ -22,7 +23,7 @@ function Template({ data }) { } = frontmatter; return ( <Layout showHeader={false} heading={title}> - <SEO blog={true} path={path} tags={tags} title={title} /> + <SEO blog={true} cover={cover} path={path} tags={tags} title={title} /> <Article attributed={attributed} author={author} @@ -44,6 +45,7 @@ export const query = graphql` frontmatter { attributed author + cover lang misattributed path