Created
December 15, 2014 12:28
-
-
Save mattvagni/f14b6e03e2873e1764a1 to your computer and use it in GitHub Desktop.
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
START_DIR=`pwd` | |
DIR="$(cd "$(dirname "$0")" && pwd)" | |
cd $DIR | |
echo -n "What's the post title?: " | |
read -e TITLE | |
# Convert to lowercase, remove punctiuation & convert spaces to Hyphens | |
SLUG=`echo $TITLE | tr '[:upper:]' '[:lower:]' | tr -d '[:punct:]' | tr '[:blank:]' '-'` | |
FILENAME_DATE=`date +"%Y-%m-%d"` | |
POST_DATE=`date +"%y-%m-%d %H:%M:%S"` | |
POST=../_posts/$FILENAME_DATE-$SLUG.md | |
# Make Post | |
touch $POST | |
# Create Front-matter | |
echo '---' >> $POST | |
echo 'layout: post' >> $POST | |
echo 'title:' $TITLE >> $POST | |
echo 'date:' $POST_DATE >> $POST | |
echo 'excerpt:' >> $POST | |
echo '---' >> $POST | |
subl $POST | |
# Go back to where we started. | |
cd $START_DIR |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment