本体で Python の関数を書いてもいいんですが、テンプレートでも関数が呼べます。
日付を出したい場合、フォーマットなら strftime() が使えます。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% if blog.date_posted %} | |
{{ blog.date_posted.strftime('%b %d, %Y') }} | |
{% endif %} |
わざわざ文字列を作って渡す必要はありません。