1
0
Fork 0
forked from github/pelican

Add period_num var for period_archives template

This makes it easier to create templates that are language-agnostic
or need extra processing for the date period.
This commit is contained in:
Petr Viktorin 2020-12-29 19:22:37 +01:00 committed by Justin Mayer
commit 487da3550b
3 changed files with 7 additions and 0 deletions

View file

@ -511,6 +511,7 @@ class ArticlesGenerator(CachingGenerator):
if key == period_date_key['year']:
context["period"] = (_period,)
context["period_num"] = (_period,)
else:
month_name = calendar.month_name[_period[1]]
if key == period_date_key['month']:
@ -520,6 +521,7 @@ class ArticlesGenerator(CachingGenerator):
context["period"] = (_period[0],
month_name,
_period[2])
context["period_num"] = tuple(_period)
write(save_as, template, context, articles=articles,
dates=archive, template_name='period_archives',