Skip to main content

Post Stats is a plugin for Pelican, a static site generator written in Python.

Post Stats calculates various statistics about a post and store them in an article.stats dictionary:

  • wc: how many words

  • read_mins: how many minutes would it take to read this article, based on 250 wpm (source)

  • word_counts: frquency count of all the words in the article; can be used for tag/word clouds

  • fi: Flesch-Kincaid Index/Reading Ease (more info)

  • fk: Flesch-Kincaid Grade Level

PyPI version number Changelog Supported Python version License Download Count

Installation

The easiest way to install Post Stats is through the use of pip. This will also install the required dependencies automatically.

pip install minchin.pelican.plugins.post_stats

On Pelican versions 4.5 and later, the plugin will automatically activate itself!

You may also need to configure your template to make use of the statistics generated.

Requirements

Post Stats depends on (and is really only useful with) Pelican. The plugin also requries Beautiful Soup 4 to process your content. If the plugin is installed from pip, these will automatically be installed. These can also be manually installed with pip:

pip install pelican
pip install beautifulsoup4

Configuration and Usage

This plugin calculates various statistics about a post and store them in an article.stats dictionary.

Example:

{
    'wc': 2760,
    'fi': '65.94',
    'fk': '7.65',
    'word_counts': Counter({u'to': 98, u'a': 90, u'the': 83, u'of': 50, ...}),
    'read_mins': 12
}

This allows you to output these values in your templates, like this, for example:

<p title="~{{ article.stats['wc'] }} words">~{{ article.stats['read_mins'] }} min read</p>
<ul>
    <li>Flesch-kincaid Index/ Reading Ease: {{ article.stats['fi'] }}</li>
    <li>Flesch-kincaid Grade Level: {{ article.stats['fk'] }}</li>
</ul>

The word_counts variable is a python Counter dictionary and looks something like this, with each unique word and it’s frequency:

Counter({u'to': 98, u'a': 90, u'the': 83, u'of': 50, u'karma': 50, .....

and can be used to create a tag/word cloud for a post.

There are no user-configurable settings.

Credits

Original plugin by Duncan Lock (@dflock) and posted to the Pelican-Plugins repo.

License

The plugin code is assumed to be under the AGPLv3 license (this is the license of the Pelican-Plugins repo).

Metadata

Release files for minchin.pelican.plugins.post-stats 1.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for minchin.pelican.plugins.post-stats 1.3.1
File Size Uploaded
minchin_pelican_plugins_post_stats-1.3.1.tar.gz 19.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for minchin.pelican.plugins.post-stats 1.3.1
File Interpreter ABI Platform
minchin_pelican_plugins_post_stats-1.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 37.3 kB

Release files / minchin_pelican_plugins_post_stats-1.3.1.tar.gz

Download URL minchin_pelican_plugins_post_stats-1.3.1.tar.gz
Size 19.2 kB
Tags Source
SHA-256 checksum
How to use checksums
a60492d123df085694a339910966c60e04bdb6eb2cb920aa8c91d71229bf6c3a
BLAKE2b-256 checksum
How to use checksums
67771360c17454fddd431bfc2ae2238f6181755d68be1474f31155929a329326
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.0

Release files / minchin_pelican_plugins_post_stats-1.3.1-py3-none-any.whl

Download URL minchin_pelican_plugins_post_stats-1.3.1-py3-none-any.whl
Size 18.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
159e55c06e28820027363353e6ba11c74896748de81555144c6cb3dcbf70d2d1
BLAKE2b-256 checksum
How to use checksums
046aaf623eb399ba7ca492df4c8a0ef930f21492aabd048725698f17f8e42c67
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.0

Release history Release notifications | RSS feed

This release

1.3.1 This release

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page