Preserve gallery order at Jekyll date precision

This commit is contained in:
2026-09-19 18:17:09 +03:30
parent b6b19c07bb
commit f6cb9573a7
19 changed files with 21 additions and 19 deletions
+3 -1
View File
@@ -82,7 +82,9 @@ def web_image(raw, destination):
def photo_entry(job, date, index, count, caption, highlight):
# Give each photo its own collection document. Descending dates preserve the
# selection order because the gallery renders the newest document first.
item_date = datetime.fromisoformat(date) + timedelta(microseconds=count - index)
# Jekyll's collection ordering only preserves whole seconds. Give each item
# a distinct second so filenames cannot disturb the selected photo order.
item_date = datetime.fromisoformat(date) + timedelta(seconds=count - index)
title = f"photo-{job}" if index == 0 else f"photo-{job}-{index:02}"
content = ["---", "layout: post", f'title: "{title}"',
f'date: "{item_date.isoformat()}"', "categories: art"]