Skip to main content

Jinja Filters for Pelican.

Project description

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 minchin.pelican.jinja_filters

Then, in your file, add Jinja Filters to your list of plugins:

            # ...
            # ...

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; speciefically Friday, November 4, 2016.
  • breaking_spaces – replaceds 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, 2016

Or with your own dateformat:

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


Article Published Nov 04, 2016

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

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

Known Issues

  • the file for this project does not run on Python 2.7. However, wheels of this project are “universal” and so can be generated by Python 3 and subsquently installed by Python 2.7.


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.

Files for minchin.pelican.jinja_filters, version 1.0.4
Filename, size File type Python version Upload date Hashes
Filename, size minchin.pelican.jinja_filters-1.0.4-py2.py3-none-any.whl (7.8 kB) File type Wheel Python version py2.py3 Upload date Hashes View hashes
Filename, size minchin.pelican.jinja_filters-1.0.4.tar.gz (5.1 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page