Preserve gallery order at Jekyll date precision
This commit is contained in:
+3
-1
@@ -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"]
|
||||
|
||||
Reference in New Issue
Block a user