Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
My build script for creating a new Jigsaw post
#!/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