This repository is unmaintained and out of date, use the jinja2content
plugin shipped with pelican-plugins
instead!
This Pelican plugin uses the Jinja2 template engine used by Pelican to render the content of articles.
This allows the use of Jinja2 template code in articles, and thus provides access to for example the extremely useful include
or import
statements of Jinja2 from within articles.
Clone this repository into a pelican-jinja2content
directory inside the plugins
directory of your Pelican project (or whatever directory you specified for plugins in Pelican's PLUGIN_PATHS
setting) and add 'pelican-jinja2content'
to the list of plugins (Pelican setting PLUGINS
) of your project. Or just use it as part of pelican-plugins
.
Simply use Jinja2 template code in your articles. If you want to use custom template files for Jinja2's include
or import
, place them into the templates
folder of your theme.
- As Markdown's
attr_list
extension inextra
uses{: ...}
to specify additional HTML attributes for the content to be rendered by Markdown, but also allows for plain{ ... }
notation, this might conflict with eventual Jinja2 template code you supply in your articles. An easy fix is to remove theattr_list
extension for Pelican'sMD_EXTENSIONS
settings variable (remove'extra'
and add all extensions inextra
manually except fromattr_list
).
No warranty whatsoever is provided for this code. Use only at your own risk!