Created
May 22, 2019 16:02
-
-
Save harsh183/7ff9948dfd82576a40d19b0496a022f9 to your computer and use it in GitHub Desktop.
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 | |
# Usage: | |
# bash jekyll_new.sh file_title | |
# Example: | |
# bash jekyll_new.sh daily-angst | |
# This script is for creating a new jeykll post under _posts/ | |
# Change as needed | |
cd _posts | |
# Ex. 2019-04-14 | |
DATE=`date +%Y-%m-%d` | |
EXTENTION='.md' | |
# Ex. 2019-04-14-daily-angst.md | |
FILE_NAME="$DATE-$1$EXTENTION" | |
if test -f "$FILE_NAME" | |
then | |
echo "File exists. Opening existing" | |
else | |
# Simple template | |
echo "--- | |
layout: post | |
title: | |
---" >> $FILE_NAME | |
fi | |
vim $FILE_NAME | |
git add $FILE_NAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note this is also with vim in mind but change that to whatever text editor you use.
Also assumes you have been using it with git and are running this in the base jekyll directory.