sana137.in

Sana's gatsbyjs-based blog
git clone http://git.hanabi.in/repos/sana137.in.git
Log | Files | Refs | README | LICENSE

commit 01b9990a3032f63ee98fcc6786a5f2c6d2eac511
parent 999d7e294bc3d4e8d9c680d6139f5bf10c8aa2ca
Author: Agastya Chandrakant <me@hanabi.in>
Date:   Sun, 15 Dec 2019 02:12:23 +0530

Using variables instead of ; actually fixes #2

Diffstat:
Msrc/templates/blogPost.js | 15+++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/templates/blogPost.js b/src/templates/blogPost.js @@ -3,7 +3,7 @@ import { graphql, Link } from 'gatsby'; import Footer from '../components/footer'; import TinyHeader from '../components/tinyHeader'; import moment from 'moment'; -import { Disqus, CommentCount } from 'gatsby-plugin-disqus'; +import { Disqus } from 'gatsby-plugin-disqus'; import 'katex/dist/katex.min.css'; @@ -40,11 +40,12 @@ function BlogPostTemplate({ data, pageContext }) { {tag} </Link> ); - const title = data.markdownRemark.frontmatter.title; + const { path, title } = data.markdownRemark.frontmatter; + const { siteUrl } = data.site.siteMetadata; const html = data.markdownRemark.html; const disqusConfig = { - url: window.location.href, - identifier: window.location.pathname, + url: `${siteUrl} + ${path}`, + identifier: path, title: title, }; return ( @@ -182,6 +183,12 @@ export const query = graphql` html frontmatter { title + path + } + } + site { + siteMetadata { + siteUrl } } }