From 30f0353e5086920e0cd84e474c984c41d1f0f618 Mon Sep 17 00:00:00 2001 From: Phyks Date: Sat, 27 Jul 2013 23:00:42 +0200 Subject: [PATCH] Added an archive page --- pre-commit.py | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/pre-commit.py b/pre-commit.py index ce87ee1..ef4faa0 100755 --- a/pre-commit.py +++ b/pre-commit.py @@ -702,3 +702,42 @@ for i in years_list: page_year_fh.write(page_year) except IOError: sys.exit("[ERROR] Unable to write index file for "+i+".") + +# Generate archive page +archives = header.replace("@title", params["BLOG_TITLE"]+" - Archives", 1) + +years_list = os.listdir("blog/") +years_list.sort(reverse=True) + +archives += "" +archives += footer + +try: + with open("blog/archives.html", "w") as archives_fh: + archives_fh.write(archives) +except IOError: + sys.exit("[ERROR] Unable to write blog/archives.html file.")