mirror of
https://github.com/Matir/skel.git
synced 2026-05-26 05:29:09 -07:00
Script to add new blog post.
This commit is contained in:
21
dotfiles/zshrc.d/blog_post.zsh
Normal file
21
dotfiles/zshrc.d/blog_post.zsh
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
if [ -d $HOME/Projects/blog/_posts ] ; then
|
||||||
|
function new_blog_post {
|
||||||
|
if [ $# -ne 1 ] ; then
|
||||||
|
echo "Usage: $0 <title>"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
WHEN=`date +%Y-%m-%d`
|
||||||
|
SLUG=$(echo -n $1|tr A-Z a-z|tr -c -s -- a-z -)
|
||||||
|
POSTS="${HOME}/Projects/blog/_posts"
|
||||||
|
FNAME="${POSTS}/${WHEN}-${SLUG}.md"
|
||||||
|
cat <<EOF >${FNAME}
|
||||||
|
---
|
||||||
|
layout: post
|
||||||
|
title: "${1}"
|
||||||
|
date: ${WHEN}
|
||||||
|
category: BLAH
|
||||||
|
---
|
||||||
|
EOF
|
||||||
|
vi ${FNAME}
|
||||||
|
}
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user