Created
September 5, 2017 01:02
-
-
Save mattstauffer/99f63961c263c9b5eab620df07566046 to your computer and use it in GitHub Desktop.
My build script for creating a new Jigsaw post
This file contains hidden or 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 | |
function slugify { | |
echo "$1" | iconv -t ascii//TRANSLIT | sed -E s/[^a-zA-Z0-9]+/-/g | sed -E s/^-+\|-+$//g | tr A-Z a-z | |
} | |
# ------------------------------- | |
echo | |
echo Creating a new blog post. | |
echo | |
echo Gimme a title: | |
read title | |
slug=`slugify "$title"` | |
# ------------------------------- | |
buildpath="$PWD/source/_posts/$slug.md" | |
echo | |
echo "Creating a file at $buildpath" | |
touch $buildpath | |
date=`date +%Y-%m-%d` | |
cat <<EOT >> $buildpath | |
--- | |
extends: _layouts.blog | |
section: markdown | |
title: "$title" | |
date: $date | |
series: | |
tags: [] | |
--- | |
EOT | |
vim $buildpath |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment