A Blake plugin that calculates estimated reading time for content based on 200 words per minute reading speed.
- Automatically calculates reading time for all markdown pages
- Uses industry standard 200 words per minute reading speed
- Adds reading time to page metadata as
readTimeMinutes - Works seamlessly with Blake's build process
Install the NuGet package:
dotnet add package BlakePlugin.ReadTimeBlake automatically discovers plugins added to your project, and runs them during the build process. Once added to your project, just bake your site as usual, and the plugin will process all markdown pages to calculate reading time.
blake bakeSpecify your own words per minutes:
blake bake --readtine:wpm=500The plugin will automatically process all markdown pages during the build and add a readTimeMinutes metadata property to each page.
Each page's estimated reading time can be accessed from the page's metadata. This is accessible via the global generated content index.
// Example in a Razor template
var readingTime = GeneratedContentIndex.GetPages().FirstOrDefault(p => p.Slug == "your-page-slug")?.Metadata["readTimeMinutes"];The plugin:
- Runs after the bake process (
AfterBakeAsync) - Counts words in each markdown page using regex pattern
\b\w+\b - Calculates reading time using 200 words per minute by default (approximate adult reading average)
- Uses user-supplied WPM via CLI arguments, if present
- Rounds up to the nearest minute
- Adds the result to the page metadata
This project is licensed under MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.