Skip to content

Instantly share code, notes, and snippets.

@jessicacarneiro
Forked from mviitanen/create-jekyll-post.sh
Last active March 18, 2016 00:00
Show Gist options
  • Select an option

  • Save jessicacarneiro/ed9e197841cd4ade1ac5 to your computer and use it in GitHub Desktop.

Select an option

Save jessicacarneiro/ed9e197841cd4ade1ac5 to your computer and use it in GitHub Desktop.
A shell script to create a new jekyll post. Maybe there is an easier way, but this script generates a basic markdown post for jekyll. It has head matter, samples of some common formatting, and a link to a more complete documentation of the format.
#!/bin/zsh
# Modified Gist https://gist.github.com/jessicacarneiro/ed9e197841cd4ade1ac5
if [ "$#" -ne 1 ] ; then
echo "Usage: $0 <title>" >&2
exit 1
fi
title=`echo "$1" |sed 's/ /-/g'`
fileName="_posts/`date +%Y-%m-%d-$title.md`"
touch $fileName
cat > $fileName <<DELIM
---
layout: post
title: "$1"
date: `date "+%Y-%m-%d %H:%M:%S"`
categories:
---
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
DELIM
mvim $fileName +8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment