I bet there is a better way to do this with jekyll itself, but I can’t get it to work…

So.. instead, and in the meantime, here’s a script to add a new post to your Jekyll site.

#!/bin/bash

dt_s=$(date '+%Y-%m-%d %H:%M:%S');
dt=$(date '+%Y-%m-%d');

title="$@"
file_title=${title// /_}

if [[ "$1" == "" ]]; then
    echo "Need post name"
    exit;
fi

filename="_posts/"${dt}-${file_title}.markdown

echo $filename

if test -f "$filename"; then
    echo "$FILE exists."
    echo "Try another"
    exit;
fi

echo "---" > $filename
echo "layout: post" >> $filename
echo "title: \""$title"\"" >> $filename
echo "date: "$dt_s >> $filename
echo "---" >> $filename
echo "" >> $filename

kate $filename