Skip to content

Commit 555c908

Browse files
committed
chore: add reading time plugin
1 parent cdc77a4 commit 555c908

File tree

6 files changed

+25
-4
lines changed

6 files changed

+25
-4
lines changed

gatsby-config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ module.exports = {
4646
},
4747
aliases: {},
4848
},
49-
// `gatsby-remark-prismjs`,
49+
`gatsby-remark-reading-time`,
5050
`gatsby-remark-copy-linked-files`,
5151
`gatsby-remark-smartypants`,
5252
],

package-lock.json

+13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"gatsby-remark-copy-linked-files": "^2.0.12",
2020
"gatsby-remark-images": "^2.0.6",
2121
"gatsby-remark-prismjs": "^3.3.27",
22+
"gatsby-remark-reading-time": "^1.1.0",
2223
"gatsby-remark-responsive-iframe": "^2.1.1",
2324
"gatsby-remark-smartypants": "^2.0.9",
2425
"gatsby-source-filesystem": "^2.0.32",

src/components/bio.js

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ function Bio() {
2121
query={bioQuery}
2222
render={data => {
2323
const { author, social } = data.site.siteMetadata
24-
console.log(data.avatar.childImageSharp.fixed)
2524
return (
2625
<div
2726
style={{

src/pages/index.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class BlogIndex extends React.Component {
3232
{title}
3333
</Link>
3434
</h3>
35-
<small>{node.frontmatter.date}</small>
35+
<small>{node.frontmatter.date} - {node.fields.readingTime.text}</small>
3636
<p
3737
dangerouslySetInnerHTML={{
3838
__html: node.frontmatter.description || node.excerpt,
@@ -61,6 +61,9 @@ export const pageQuery = graphql`
6161
excerpt
6262
fields {
6363
slug
64+
readingTime {
65+
text
66+
}
6467
}
6568
frontmatter {
6669
date(formatString: "MMMM DD, YYYY")

src/templates/blog-post.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class BlogPostTemplate extends React.Component {
2727
marginTop: rhythm(-1),
2828
}}
2929
>
30-
{post.frontmatter.date}
30+
{post.frontmatter.date} - {post.fields.readingTime.text}
3131
</p>
3232
<div dangerouslySetInnerHTML={{ __html: post.html }} />
3333
<hr
@@ -85,6 +85,11 @@ export const pageQuery = graphql`
8585
date(formatString: "MMMM DD, YYYY")
8686
description
8787
}
88+
fields {
89+
readingTime {
90+
text
91+
}
92+
}
8893
}
8994
}
9095
`

0 commit comments

Comments
 (0)