Skip to content
A Reading time metadata plugin for Wyam pipelines
PowerShell C#
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Build status Stable Nuget

A simple static reading time calculator for plugging into a Wyam pipeline.

Currently uses a very simplistic algorithm and adds metadata object to the pipeline for each post so you can display the information wherever you want on your site.


// Config.wyam

// If you're using the blog recipe then you can use this handy helper
Pipelines.AddReadingTimeMeta(wordsPerMinute: 200);

// If you've setup your own pipeline or know when your content should be processed just add something like the following
Pipelines["BlogPosts"].InsertBefore("WriteMetadata", new ReadingTime(wordsPerMinute: 200));

This will add a ReadingTimeMeta object to your context which you can retrieve like:

var meta = document.Get<ReadingTimeMeta>(ReadingTimeKeys.ReadingTime);

This is currently very rough and allows you to display this information as you like but on my blog I'm doing:

<p class="post-meta">
    Posted on @(post.Get<DateTime>(BlogKeys.Published).ToLongDateString(Context))
    <br />
    Estimated read time:  @(readingMeta.Minutes == 0 ? $"a couple of seconds" : $"{readingMeta.Minutes} minutes") (@(readingMeta.Words) words)
You can’t perform that action at this time.