sorted by date main feed
This commit is contained in:
parent
952a773875
commit
193ba0b4a5
@ -25,17 +25,24 @@ page = f"""Personal blog of one {choice(ADJECTIVES)} Veclav Talica.
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# todo: Sort by date first.
|
artciles = {}
|
||||||
for root, dirs, _ in walk(argv[1]):
|
for root, dirs, _ in walk(argv[1]):
|
||||||
for d in dirs:
|
for d in dirs:
|
||||||
metadata = parse_metadata(path.abspath(root + '/' + d + "/page.mmd"))
|
metadata = parse_metadata(path.abspath(root + '/' + d + "/page.mmd"))
|
||||||
article = urllib.parse.quote(d)
|
article = urllib.parse.quote(d)
|
||||||
page += (
|
artciles[article] = {
|
||||||
f"""[{metadata.get("Title", "No title given! What a clusterfuck!")}](/articles/{article}.html)\n\n"""
|
"metadata": metadata
|
||||||
f""">{metadata.get("Brief", "")}\n\n"""
|
}
|
||||||
)
|
|
||||||
break
|
break
|
||||||
|
|
||||||
|
for title in sorted(artciles.keys(), key=lambda a: artciles[a]["metadata"].get("Date", time.gmtime(0)), reverse=True):
|
||||||
|
article = artciles[title]
|
||||||
|
metadata = article["metadata"]
|
||||||
|
page += (
|
||||||
|
f"""[{metadata.get("Title", "No title given! What a clusterfuck!")}](/articles/{article}.html)\n\n"""
|
||||||
|
f""">{metadata.get("Brief", "")}\n\n"""
|
||||||
|
)
|
||||||
|
|
||||||
curtime = time.gmtime(int(time.time()))
|
curtime = time.gmtime(int(time.time()))
|
||||||
page += f"Last compiled: *{MONTHS[curtime.tm_mon]} {curtime.tm_mday}, {curtime.tm_year} {curtime.tm_hour}:{curtime.tm_min:02d} UTC*\n\n"
|
page += f"Last compiled: *{MONTHS[curtime.tm_mon]} {curtime.tm_mday}, {curtime.tm_year} {curtime.tm_hour}:{curtime.tm_min:02d} UTC*\n\n"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user