Created
April 3, 2013 07:39
-
-
Save maguay/5299154 to your computer and use it in GitHub Desktop.
Bash script for creating new Kirby posts via Alfred. Fork from http://plausiblethought.net/creating-new-blog-posts-with-an-alfred-workflow. Don't escape spaces. See full Alfred 2 Workflow at https://github.com/maguay/Alfred-New-Kirby-Blog-Post.
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
/* navigate to blog folder */ | |
cd ~/your_site_folder/content/your_blog_folder/ | |
/* count files */ | |
COUNT=$(ls | wc -l) | |
/* remove feed folder from count */ | |
NEWCOUNT=$(expr $COUNT - 1) | |
/* replace spaces in query with dashes for folder name */ | |
DNAME=$(echo {query} | tr " " "-") | |
/* make folder */ | |
mkdir $NEWCOUNT-$DNAME | |
/* change directory */ | |
cd $NEWCOUNT-$DNAME | |
/* get date */ | |
DATE=`date "+%a, %d %b %Y %X"` | |
/* create a file called article.md with query as title, along with the date */ | |
echo "Title: {query} | |
---- | |
Date: $DATE | |
---- | |
Text: | |
" > article.md | |
open article.md |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment