Jekyll 'New Post' Script
On the blogging platform I’ve decided to use for the time being, Jekyll, I found it a tad annoying to create new posts in a timely way.
It’s not difficult to create a
.markdown file and copy in a template, but the naming convention of the files,
YYYY-MM-DD-Title combined with the front matter metadata you have to put in the headers made the process take just a few seconds longer than I was comfortable with. You have to enter the date twice in a specified format, and it just ‘felt’ like something a computer should be doing, instead of me.
This seamed like an excellent place for a Python script to step in!
So, I wrote the following tiny snippet of code, and now I can create a new markdown file in a few seconds flat!
Just execute with
python new_post.py in your
_posts directory. It’ll prompt you for a
categories and then save all of that information, along with the current date/time, into a handy markdown file.