Alfred scripts for Jekyll
Posted 26.02.2013 ยท 1 min readAlfred App is the productivity application I use the most, and the one that actually boosts productivity. I recently started to use Jekyll as a blog engine. I wanted an easy way to open a new file with the default parameters already in place. The tool for the job was a shell script as a Alfred extension
DRAFT_PATH=~/relekang.github.com/drafts/{query}.md
if [ -f $DRAFT_PATH ]then echo "File exists" open http://127.0.0.1:4000/drafts/{query}.html open $DRAFT_PATHelse echo "Creating file" touch $DRAFT_PATH echo "---" > $DRAFT_PATH open http://127.0.0.1:4000/drafts/{query}.html open $DRAFT_PATHfi
# { page.title }
has double curly-brackets in the script, but I could not get Jekyll to ignore them.
I also wanted an easy way to add date and copy the post to _posts
when I am finished writing it.
DATE=date '+%Y-%m-%d'DRAFT_PATH=~/relekang.github.com/drafts/{query}.mdPUBLISH_PATH=~/relekang.github.com/_posts/$DATE-{query}.md
if [ -f $DRAFT_PATH ]then mv $DRAFT_PATH $PUBLISH_PATH echo "Post added to _posts"else echo "Could not find draft"fi
Both scripts are set up with Silent = True and Output = True. Silent stops Alfred from opening a terminal window. Output makes output data appear in notification center.
#alfredapp, #jekyll, #shell script