Skip to content

Instantly share code, notes, and snippets.

@bronzehedwick
Last active December 12, 2022 13:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bronzehedwick/050aea1d3971552ff243 to your computer and use it in GitHub Desktop.
Save bronzehedwick/050aea1d3971552ff243 to your computer and use it in GitHub Desktop.
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