Skip to content
Pelican plugin for word count and reading time statistics
Python Makefile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
.travis.yml
LICENSE
Makefile
README.rst
__init__.py
requirements.txt
setup.cfg
word_count.py

README.rst

https://travis-ci.org/pilosus/pilosus_pelican_word_count.svg?branch=master

Pelican plugin for word count and reading time statistics

About

Words are extracted and refined from the rendered HTML.

Reading time is in minutes and calculated assuming average reading speed equal to 250 words per minute.

Installation

  1. Place plugin in a directory, e.g plugins/pilosus_pelican_word_count. You can clone it or add it to your blog repo as a submodule:
$ cd /path/to/your/static/site/repo
$ git submodule add https://github.com/pilosus/pilosus_pelican_word_count plugins/pilosus_pelican_word_count
  1. Add plugins configurations in a settings file:
PLUGIN_PATHS = ['plugins']
PLUGINS = ['pilosus_pelican_word_count',]

Usage

Plugin adds a stats attribute holding dictionary with article or page statistics:

{
  'word_count': 500,
  'read_minutes': 2,
}

In your template you can use it like this:

{% if article and article.stats %}
<span class="stats">article.stats['word_count'] words, article.stats['read_minutes'] minutes to read</span>
{% endif %}

{% if page and page.og %}
<span class="stats">page.stats['word_count'] words, page.stats['read_minutes'] minutes to read</span>
{% endif %}

License

This work is licensed under GNU AFFERO GENERAL PUBLIC LICENSE Version 3. See LICENSE file

You can’t perform that action at this time.