-
-
Save laescalera/51acbb3087ba7518e8697ef7038f598c to your computer and use it in GitHub Desktop.
This bash script will setup a new Jekyll blog post in Markdown and open it for editing in Sublime Text 2
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 | |
# Katie Harron - @pibby | |
# This bash script will setup a new Jekyll blog post in Markdown and open it for editing in Sublime Text 2 | |
echo "Post Title: " | |
read title | |
echo "Post Description: " | |
read desc | |
echo "Post Tags: " | |
read tags | |
echo "Post Keywords: " | |
read keyw | |
echo "Banner image (bg_ .jpg): " | |
read img | |
ptitle=${title// /-} # convert spaces in title to hyphens | |
plc=`echo "$ptitle" | tr '[:upper:]' '[:lower:]'` # convert title to lowercase | |
pdate=`date +%Y-%m-%d` # create date as Year-Month-Date | |
filename=~/Sites/katieharron/_posts/$pdate-$plc.md # location to create the new file as year-month-day-title.md | |
touch $filename # create the new blank post | |
echo "--- | |
layout: post | |
title: $title | |
description: $desc | |
categories: articles | |
date: $pdate | |
tags: [$tags] | |
keywords: [$keyw] | |
image: $img | |
---" > $filename # fill out YAML Front Matter and insert into our new file | |
/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl $filename # open in Sublime Text 2 (Mac OS X) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment