gatsby-read-time-estimate
Version:
Gatsby plugin to add an accurate measurement of read time using any content
14 lines (11 loc) • 352 B
JavaScript
const readTimeEstimate = require('read-time-estimate/dist/read-time-estimate');
exports.onCreateNode = ({ node, actions }) => {
const { createNodeField } = actions;
if (node.internal && node.internal.content) {
createNodeField({
name: 'readTimeEstimate',
node,
value: readTimeEstimate(node.internal.content),
});
}
};