Pelican Add Buddhist Calendar


Use Pelican static site generator to add Buddhist calendar in your theme.

Usually the datetime format (Gregorian calendar) in the theme looks like:

{{ article.date | strftime('%B %d, %Y') }}

Now we will change Gregorian calendar to Buddhist calendar. First define a Jinja2 macro:

{% macro Buddhist_calendar(datetime) -%}
{{ datetime | strftime('%B %d') }}, {{ datetime.year + 543 }}
{%- endmacro %}

Use the macro in your theme by:

{{ Buddhist_calendar(article.date) }}

Tested on: Ubuntu Linux 15.10, Python 2.7.10, Pelican 3.6.3.


References:

[1]add Buddhist calendar · siongui/pelican-template@4616e29 · GitHub