diff --git a/tasks.py b/tasks.py index 704f357..e635bf3 100644 --- a/tasks.py +++ b/tasks.py @@ -148,22 +148,19 @@ def new_post(c): import os from slugify import slugify iso_date = datetime.datetime.today().strftime('%Y-%m-%d') - year, month, day = iso_date.split("-") title = input("Title: ") slug = slugify(title) filename = f"{iso_date}_{slug}.rst" title_header = "#" * len(title) template = f"""{title} {title_header} -:date: {datetime.datetime.today().strftime('%Y-%m-%d %H:%M')} :author: tyrel :category: ???? :tags: ???? -:slug: {slug} :status: draft """ - base = f"content/blog/{year}/{month}" + base = f"content/blog" os.makedirs(os.path.dirname(base), exist_ok=True) with open(f"{base}/{filename}", "w") as f: f.write(template)