Last active
December 12, 2022 13:05
-
-
Save bronzehedwick/050aea1d3971552ff243 to your computer and use it in GitHub Desktop.
Automate Jekyll Post Creation
This file contains hidden or 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 | |
# 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