Skip to content

Commit

Permalink
chore: add reading time plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdriaguine committed Dec 17, 2019
1 parent cdc77a4 commit 555c908
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ module.exports = {
},
aliases: {},
},
// `gatsby-remark-prismjs`,
`gatsby-remark-reading-time`,
`gatsby-remark-copy-linked-files`,
`gatsby-remark-smartypants`,
],
Expand Down
13 changes: 13 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"gatsby-remark-copy-linked-files": "^2.0.12",
"gatsby-remark-images": "^2.0.6",
"gatsby-remark-prismjs": "^3.3.27",
"gatsby-remark-reading-time": "^1.1.0",
"gatsby-remark-responsive-iframe": "^2.1.1",
"gatsby-remark-smartypants": "^2.0.9",
"gatsby-source-filesystem": "^2.0.32",
Expand Down
1 change: 0 additions & 1 deletion src/components/bio.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ function Bio() {
query={bioQuery}
render={data => {
const { author, social } = data.site.siteMetadata
console.log(data.avatar.childImageSharp.fixed)
return (
<div
style={{
Expand Down
5 changes: 4 additions & 1 deletion src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class BlogIndex extends React.Component {
{title}
</Link>
</h3>
<small>{node.frontmatter.date}</small>
<small>{node.frontmatter.date} - {node.fields.readingTime.text}</small>
<p
dangerouslySetInnerHTML={{
__html: node.frontmatter.description || node.excerpt,
Expand Down Expand Up @@ -61,6 +61,9 @@ export const pageQuery = graphql`
excerpt
fields {
slug
readingTime {
text
}
}
frontmatter {
date(formatString: "MMMM DD, YYYY")
Expand Down
7 changes: 6 additions & 1 deletion src/templates/blog-post.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class BlogPostTemplate extends React.Component {
marginTop: rhythm(-1),
}}
>
{post.frontmatter.date}
{post.frontmatter.date} - {post.fields.readingTime.text}
</p>
<div dangerouslySetInnerHTML={{ __html: post.html }} />
<hr
Expand Down Expand Up @@ -85,6 +85,11 @@ export const pageQuery = graphql`
date(formatString: "MMMM DD, YYYY")
description
}
fields {
readingTime {
text
}
}
}
}
`

0 comments on commit 555c908

Please sign in to comment.