summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorDennis Fink2026-11-06 08:04:54 +0100
committerDennis Fink2026-11-06 08:04:54 +0100
commit3ccac9a70669db5cd9d83a1d05b02e0c43cf58c6 (patch)
tree52cd7823f44119bd455e45e1d82abe16183da5cb /templates
parent550252e137dedf8b4d54c961f10850c74c0bc9bf (diff)
downloaddennisfink.me-3ccac9a70669db5cd9d83a1d05b02e0c43cf58c6.tar.gz
dennisfink.me-3ccac9a70669db5cd9d83a1d05b02e0c43cf58c6.zip
Add reading time estimates to blog posts
This adds a project-local Lektor plugin that estimates reading time from article text and images, using NLTK for word tokenization and decreasing time weights for successive images. The plugin exposes a `reading_time` template function and displays the estimated reading time alongside other blog post metadata.
Diffstat (limited to '')
-rw-r--r--templates/macros/blog.html6
1 files changed, 6 insertions, 0 deletions
diff --git a/templates/macros/blog.html b/templates/macros/blog.html
index 09e6a65..465e9d0 100644
--- a/templates/macros/blog.html
+++ b/templates/macros/blog.html
@@ -74,6 +74,12 @@
</dd>
</div>
{% endif %}
+ <div>
+ <dt>Reading time:</dt>
+ <dd>
+ ~{{ reading_time(post) }}
+ </dd>
+ </div>
<a rel="author"
class="p-author h-card display-none"
href="{{ '/about' | url(absolute=True) }}">Dennis Fink</a>