Skip to main content

PRs Welcome Conventional Commits GitHub Actions PyPI Package latest release PyPI Package download count (per month) Supported versions

pelican_stat

Generate Pelican article statistics from the command line or expose them to Pelican themes and content through a plugin.

Getting Started

Prerequisites

Pelican plugin

Install pelican_stat in the same environment as your Pelican site:

uv add pelican_stat

Then enable the plugin in pelicanconf.py:

PLUGINS = [
    "pelican.plugins.stat",
]

The plugin adds these values to the template context:

  • pelican_stat_word_count: a mapping containing post_count, cjk_char_count, english_word_count, total_char_count, writing_years, average_chars_per_article, and median_chars_per_article.
  • pelican_stat_trend_plot_html: a Plotly HTML fragment. Render it with the Jinja safe filter and make sure the theme loads Plotly.js.

For example:

{{ pelican_stat_word_count.total_char_count }}
{{ pelican_stat_trend_plot_html | safe }}

Writing statistics shortcode

In Markdown content, put the full widget on its own line:

{% writing_stats %}

The full widget shows CJK characters, English words, total characters, average characters per post, and median characters per post. A compact variant shows only total and average characters:

{% writing_stats compact %}

The widget includes scoped styles and chooses its labels from the content's Lang metadata, then DEFAULT_LANG, and finally English. English (en) and Taiwanese Mandarin (zh-TW) labels are built in; language matching is case-insensitive. Other language tags, including bare zh, fall back to English.

Plugin settings

All settings are optional and belong in pelicanconf.py:

Setting Default Description
PELICAN_STAT_SHORTCODE "writing_stats" Changes the shortcode name. For example, "blog_stats" enables {% blog_stats %} and {% blog_stats compact %}.
PELICAN_STAT_LABELS {} Partially overrides the built-in labels. Use a mapping keyed by en or zh-TW, with statistic field names as the nested keys.
PELICAN_STAT_INCLUDE_CODE_BLOCKS False Includes text inside block-level <pre> elements in word and character statistics. Inline <code> text is always included.

Label overrides are merged with the selected built-in locale, so unspecified labels keep their defaults:

PELICAN_STAT_LABELS = {
    "en": {
        "total_char_count": "Characters Written",
    },
    "zh-TW": {
        "total_char_count": "累積字元數",
        "average_chars_per_article": "平均每篇字元數",
    },
}

The available label keys are the seven keys listed under pelican_stat_word_count above.

Command-line usage

For installing this tool, I suggest using uv tool, pipx or something similar.

uv tool install pelican_stat

After installation, you can see the detail by add --help flag.

e.g.,

pelican-stat --help

or

pelican-stat collect --help

or

pelican-stat plot --help

or

pelican-stat wordcount --help

Contributing

See Contributing

Authors

Wei Lee weilee.rx@gmail.com

Created from Lee-W/cookiecutter-python-template version 3.0.0

Metadata

Release files for pelican-stat 0.4.0

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

Source distribution (sdist)

Source distribution for pelican-stat 0.4.0
File Size Uploaded
pelican_stat-0.4.0.tar.gz 27.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pelican-stat 0.4.0
File Interpreter ABI Platform
pelican_stat-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 56.9 kB

Release files / pelican_stat-0.4.0.tar.gz

Download URL pelican_stat-0.4.0.tar.gz
Size 27.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a640379310a5379280e1e97db2c6b348e78eeaeb04306a6d7a92d797616cc2d7
BLAKE2b-256 checksum
How to use checksums
cf8189a4b88689a843016cab973d02418062e042a18e516a074c2d3a1f121894
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 10, 2026.

Transparency log

Release files / pelican_stat-0.4.0-py3-none-any.whl

Download URL pelican_stat-0.4.0-py3-none-any.whl
Size 29.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6bd8f95102198ad2205053137993f0434b9cea9d1e0055c46a38295072be1cb5
BLAKE2b-256 checksum
How to use checksums
0d5873a3f5887ba0e4910a1529997ee5dfd93025f2c224a52e67b12cae6e2e53
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 10, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.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