Last active
August 29, 2015 13:55
-
-
Save rigelk/8770430 to your computer and use it in GitHub Desktop.
jekyll post generator
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
#!/bin/bash | |
# Author: Pierre-Antoine Rault (rigelk) | |
# Sauce: https://gist.github.com/rigelk | |
# Licence: BSD licence | |
usage="USAGE ./new_event [editor]" | |
if [ $1 ] | |
then | |
read -r -p "Post name > " | |
title=${REPLY} | |
read -r -p "Category > " | |
cat=${REPLY} | |
title_clean="$(<<< "$title" \ | |
iconv -f utf8 -t ascii//translit \ | |
| tr ' [:upper:]' '-[:lower:]' \ | |
| tr -dc 'a-z0-9._-')" | |
filename="_posts/$(date "+%Y-%m-%d")-$title_clean.md" | |
echo "--- | |
layout: post | |
title: $title | |
categories: $cat | |
---" > "$filename" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment