Skip to main content

Pelican plugin for applying useful Jinja filters in theme templates

Project description

Build Status PyPI Version

Jinja Filters is a plugin for Pelican, a static site generator written in Python.

Jinja Filters provides a selection of functions (called filters) for templates to use when building your website. They are packaged for Pelican, but may prove useful for other projects that make use of Jinja2.


The easiest way to install Jinja Filters is through the use of Pip. This will also install the required dependencies (currently pelican and titlecase) automatically.

pip install pelican-jinja-filters

As Jinja Filters is a namespace plugin, it should automatically be loaded by Pelican. And that’s it! The filters are now available for use in your templates.


At present, the plugin includes the following filters:

  • datetime – allows you to change to format displayed for a datetime object. Optionally supply a datetime format string to get a custom format.

  • article_date – a specialized version of datetime that returns datetimes as wanted for article dates; specifically Friday, November 4, 2020.

  • breaking_spaces – replaces non-breaking spaces (HTML code &nbsp) with normal spaces.

  • titlecase – Titlecases the supplied string.

For example, within your theme templates, you might have code like:

<span class="published">
    Article Published {{ | article_date }}


Article Published Friday, November 4, 2020

Or with your own date format:

<span class="published">
    Article Published {{ | datetime('%b %d, %Y') }}


Article Published Nov 04, 2020

Filters can also be chained, or applied in sequence. For example to remove breaking spaces and then titlecase a category name, you might have code like:

<a href="{{ SITEURL }}/{{ article.category.url }}">
    {{ article.category | breaking_spaces | titlecase}}


Jinja Filters is under the MIT License. See attached License.txt for full license text.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pelican-jinja-filters-2.0.0.tar.gz (5.8 kB view hashes)

Uploaded source

Built Distribution

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page