Statistics: A Plugin for Pelican
Statistics is a Pelican plugin that calculates post statistics such as word count, reading ease, and more.
Installation
This plugin can be installed via:
python -m pip install pelican-statistics
As long as you have not explicitly added a PLUGINS setting to your Pelican settings file, then the newly-installed plugin should be automatically detected and enabled. Otherwise, you must add statistics to your existing PLUGINS list. For more information, please see the How to Use Plugins documentation.
Usage
This plugin calculates various statistics about a post and stores them in an article.statistics dictionary:
wc: the number of words in the articleread_mins: how many minutes it would take to read this article, based on 250 WPMword_counts: frequency count of all the words in the article — can be used for tag/word cloudsfi: Flesch Reading Easefk: Flesch–Kincaid Grade Level
article.statistics dictionary example:
{
'wc': 2760,
'fi': '65.94',
'fk': '7.65',
'word_counts': Counter({"to": 98, "a": 90, "the": 83, "of": 50, ...}),
'read_mins': 12
}
This article.statistics dictionary allows you to output these values in your templates. For example:
<p title="~{{ article.statistics['wc'] }} words">~{{ article.statistics['read_mins'] }} min read</p>
<ul>
<li>Flesch Reading Ease: {{ article.statistics['fi'] }}</li>
<li>Flesch–Kincaid Grade Level: {{ article.statistics['fk'] }}</li>
</ul>
The word_counts variable is a python Counter dictionary and looks something like the following, with each unique word and its frequency:
Counter({"to": 98, "a": 90, "the": 83, "of": 50, "karma": 50, .....
This word_counts variable can be used to create a tag/word cloud for a post.
Contributing
Contributions are welcome and much appreciated. Every little bit helps. You can contribute by improving the documentation, adding missing features, and fixing bugs. You can also help out by reviewing and commenting on existing issues.
To start contributing to this plugin, review the Contributing to Pelican documentation, beginning with the Contributing Code section.
License
This project is licensed under the AGPL-3.0 license.
Release files for pelican-statistics 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pelican_statistics-1.0.0.tar.gz | 5.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pelican_statistics-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.7 kB
Release files / pelican_statistics-1.0.0.tar.gz
| Download URL | pelican_statistics-1.0.0.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d9d20b262bb8e9af975c68fb73169fd9d588f26ff340260387ec4dc81f2d13b0
|
|
BLAKE2b-256 checksum How to use checksums |
5eb5ff348ea371553423afd666bc6544509b6b4ed267f77887972088cac0109f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.22.2 CPython/3.11.11 Darwin/24.2.0
|
Release files / pelican_statistics-1.0.0-py3-none-any.whl
| Download URL | pelican_statistics-1.0.0-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f2397fc1cee0731e65057d755c5aa8811d075b20c11b2bdc07a88ea7b7dc40e1
|
|
BLAKE2b-256 checksum How to use checksums |
8994cea69c4042022106cf9ae93c6d1af32770bf8f154903d09a63d305f01043
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.22.2 CPython/3.11.11 Darwin/24.2.0
|