from slugify import slugify import _utils title = input("Enter draft's title: ") slug = slugify(title) fm = _utils.loads("---\n---\n") fm.metadata["title"] = title with open(f"_drafts/{slug}.gmi", mode="w", encoding="utf8") as file: file.write(_utils.dumps(fm))