Skip to content

Instantly share code, notes, and snippets.

@eyedeekay
Last active July 18, 2016 08:57
Show Gist options
  • Save eyedeekay/cb3b1b1e41ee0d70b28a3d1a5a839f2e to your computer and use it in GitHub Desktop.
Save eyedeekay/cb3b1b1e41ee0d70b28a3d1a5a839f2e to your computer and use it in GitHub Desktop.
Jekyll Create Post Alias
#! /bin/sh
#Source this into your bash_aliases file for use.
jkllcp(){
[ -z "$1" ] && exit 1
TITLE=$(echo $1 | tr " " "-")
DATE=$(date +%Y-%m-%d)
if [ -d "_posts" ]; then
echo "---
layout: post
title: $1
---
" > "_posts/$DATE-$TITLE.md"
elif [ pwd | grep '\_posts' ]; then
echo "---
layout: post
title: $1
---
" > "$DATE-$TITLE.md"
fi
}
alias jkllcp="jkllcp $1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment