diff --git a/src/routes/index.py b/src/routes/index.py index 6a44e67..bc83c88 100644 --- a/src/routes/index.py +++ b/src/routes/index.py @@ -13,7 +13,18 @@ def index() -> str: """index page""" posts = [] if not Config.private or (Config.private and Config.is_logged()): - posts = [p.split("/")[-1][:-4] for p in get_posts()] + for p in get_posts(): + + def titleify(s): + return s.split("/")[-1] + + def linkify(s): + return ".".join(titleify(s).split(".")[:-1]) + + def datify(s): + return s[:-14] + " " + s[-4:] + + posts.append((linkify(p), titleify(p), datify(get_post_cdate(p)))) return render_template( "index.html", diff --git a/src/templates/index.html b/src/templates/index.html index bc91bba..357514f 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -19,7 +19,8 @@ diff --git a/src/utils/misc.py b/src/utils/misc.py index c831032..123568b 100644 --- a/src/utils/misc.py +++ b/src/utils/misc.py @@ -51,7 +51,11 @@ def get_post(filename: str) -> File | None: return None else: with open(filename, "r") as reader: - return File(reader.read(), ctime(os_path.getmtime(filename))) + return File(reader.read(), get_post_cdate(filename)) + + +def get_post_cdate(filename: str) -> str: + return ctime(os_path.getmtime(filename)) def delete_post(filename: str) -> bool: