How I Blog
Here’s my setup for posting to this blog.
I set up my blog on github pages with jekyll by forking and configuring this repo.
Once that was out of the way, I wrote a few shell scripts to help automate blogging for me.
The first script is blogpost.py, which handles writing the blog post. When you run the script, you’re prompted to enter a title for your post. After you give it a title, the script creates and opens a markdown file with that title and some other metadata filled in automatically, including time of day and a list of categories.
Once opened for editing, you can edit the categories and actually write the post.
Save and exit the editor when you’re done writing the post.
Next up, I wrote publishpost.py to handle actually submitting the post to the blog.
When you run this script, it prints out a list of unpublished posts on the local machine and asks which one you want to submit. Enter your selection (likely only the single option if you write and then submit each time, but you could be working on multiple posts at once), and the script will add the post’s file to git, create a git commit and then push it to the repository.
From there, jekyll will automatically render the post and display it on the blog.
I’d like to have a few other options:
- Maybe a (semi-)live preview while editing the post? Might be nice to make sure you’re writing proper markdown.
- Some way to automatically open a local draft post in an editor, in addition to being able to auto-push it?
- Make it possible to push multiple posts at the same time?