Last active
July 18, 2016 08:57
-
-
Save eyedeekay/cb3b1b1e41ee0d70b28a3d1a5a839f2e to your computer and use it in GitHub Desktop.
Jekyll Create Post Alias
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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