Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for display_timestamp setting #524

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/sigal/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"colorbox_column_size": 3,
"copy_exif_data": False,
"datetime_format": "%c",
"display_timestamp": False,
"destination": "_build",
"files_to_copy": (),
"galleria_theme": "classic",
Expand Down
3 changes: 3 additions & 0 deletions src/sigal/templates/sigal.conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@
# https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior
# datetime_format = '%c'

# Display generated datetime in the resulting output
# display_timestamp = False

# Jpeg options
# jpg_options = {'quality': 85,
# 'optimize': True,
Expand Down
3 changes: 3 additions & 0 deletions src/sigal/themes/default/templates/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,8 @@
<span><a href={{ settings.atom_feed.feed_url }}>Atom Feed</a></span>
{% endif %}
{% endif %}
{% if settings.display_timestamp %}
@ {{ generated_timestamp }}
{% endif %}
</p>
</footer>
2 changes: 2 additions & 0 deletions src/sigal/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import stat
import sys
import types
from datetime import datetime

from jinja2 import ChoiceLoader, Environment, FileSystemLoader, PrefixLoader
from jinja2.exceptions import TemplateNotFound
Expand Down Expand Up @@ -138,6 +139,7 @@ def generate_context(self, album):
"index_title": self.index_title,
"settings": self.settings,
"sigal_link": sigal_link,
"generated_timestamp": datetime.now().strftime(self.settings['datetime_format']),
"theme": {
"name": os.path.basename(self.theme),
"url": url_from_path(os.path.relpath(self.theme_path, album.dst_path)),
Expand Down