diff options
Diffstat (limited to 'build.py')
-rwxr-xr-x | build.py | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -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)) |