Created
April 6, 2011 16:13
-
-
Save joshkerr/905952 to your computer and use it in GitHub Desktop.
This is a quick script to create a new post in Jekyll
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
# create a new post and fill the template | |
alias create="sh ~/.postname" | |
# the contents of ~/.postname: | |
#!/bin/zsh | |
################ | |
# Get our info # | |
################ | |
yearmonth=`date "+%Y/%m"` | |
postdate=`date "+%Y-%m-%d"` | |
jekylldate=`date "+%Y-%m-%d"` | |
read -p "Enter the post name: " post_variable; | |
touch /Users/TJ/Desktop/foobar.com/_posts/$yearmonth/$postdate-$post_variable.markdown && | |
cat <<EOF > /Users/TJ/Desktop/foobar.com/_posts/$yearmonth/$postdate-$post_variable.markdown | |
--- | |
layout: post | |
date: $jekylldate | |
title: $post_variable | |
excerpt: | |
--- | |
EOF | |
mate /Users/TJ/Desktop/foobar.com/_posts/$yearmonth/$postdate-$post_variable.markdown | |
exit 0 | |
# start up Jekyll for local preview of blog | |
alias preview="cd /Users/TJ/Desktop/foobar.com && jekyll --server --auto" | |
# delete the existing built site and rebuild | |
alias build="cd /Users/TJ/Desktop/foobar.com && rm -rf _site/ && jekyll" | |
# use rsync to push the weblog to my (ve) | |
alias deploy="echo 'Deploying to remote host...' && | |
cd /Users/TJ/Desktop/foobar.com && rsync -rtz --delete _site/ deploy@foobar.com:/var/www/_site && | |
echo 'Done!'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment