summaryrefslogtreecommitdiff
path: root/build.py
diff options
context:
space:
mode:
authorBlaise Thompson <blaise@untzag.com>2020-12-08 20:04:08 -0600
committerBlaise Thompson <blaise@untzag.com>2020-12-08 20:04:08 -0600
commit6f26b933e68a7b209a1f32af61103fd2f552a3e8 (patch)
treef0d58112c524d28e61df9d115c1ff5b5d02c8b41 /build.py
parent860fce03cf1efccca8fe6378b952dc4bde51d31e (diff)
mug-holder
Diffstat (limited to 'build.py')
-rwxr-xr-xbuild.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/build.py b/build.py
index 3394180..6505dbb 100755
--- a/build.py
+++ b/build.py
@@ -1,4 +1,5 @@
import os
+import shutil
import jinja2
import markdown
import pathlib
@@ -33,6 +34,8 @@ posts = []
for post in os.listdir(__here__ / "posts"):
if len(post) < 3:
continue
+ if not post.endswith(".md"):
+ continue
with open(__here__ / "posts" / post, "r") as f:
content = md.convert(f.read())
kwargs = dict()
@@ -52,6 +55,9 @@ if not os.path.isdir(__here__ / "public"):
os.mkdir(__here__ / "public")
+shutil.copytree("posts", "public", dirs_exist_ok=True)
+
+
template = env.get_template("index.html")
with open(__here__ / "public" / "index.html", "w") as f:
f.write(template.render(posts=posts, title="blog", date=date))