Skip to content

Commit

Permalink
Make current datetime available in templates as now.
Browse files Browse the repository at this point in the history
  • Loading branch information
yaph committed Jun 13, 2023
1 parent 6a63254 commit 1f5385b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions logya/template.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
from datetime import datetime
from operator import itemgetter
from pathlib import Path
from string import ascii_lowercase
Expand Down Expand Up @@ -107,6 +108,9 @@ def init_env(L):
# Get documents from a URL.
env.globals['get_docs'] = lambda url='', **kwargs: _get_docs(L, url, **kwargs)

# Make current datetime available.
env.globals['now'] = datetime.utcnow

# Include the site settings last.
env.globals.update(L.settings['site'])

Expand Down

0 comments on commit 1f5385b

Please sign in to comment.