Last active
May 16, 2021 23:16
-
-
Save pibby/6911493 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
Katie,
Hope you find my modifications to your script useful.
Would you be agreeable to applying the Apache 2 license?
All that would be required would be to include this at the top of the script:
I have already done this to my version, but unless you do the same I cannot publish that change.
Thanks,
Mike