Skip to content

Instantly share code, notes, and snippets.

@bronzehedwick bronzehedwick/new_post.sh
Last active Jul 7, 2019

Embed
What would you like to do?
Automate Jekyll Post Creation
#!/bin/bash
# Create a new post for a Jekyll blog.
cd /path/to/your/jekyll/repo/_posts
FILETILE=$(echo "$1" | tr " " "-" | tr '[:upper:]' '[:lower:]')
POSTDATE=$(\date +"%Y-%m-%d")
POSTNAME=$POSTDATE-$FILETILE.md
POSTBODY="---
layout: post
title: $1
date: $POSTDATE $(\date +"%H:%M:%S")
summary:
categories:
---"
cat <<EOF >> $POSTNAME
$POSTBODY
EOF
open "$POSTNAME"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.