So I wrote a little bash script this morning to make creating a new jekyll post easy for my blog.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
array=( $@ )
len=${#array[@]}
_first=$1
_last=${array[$len-1]}
_rest=${array[@]:1:$len-2}
_filename=$( printf "%s-%s" "$(date +%F)" "$_first" )
_postname=$( printf "%s %s" "$_first" "$_rest" )
echo $_rest
for var in $_rest
do
_filename+="-"
_filename+=$var
done
cat <<EOF > _posts/$_filename.md
---
layout: ['post', 'reader']
title: $_postname
comments: true
date: $(date +%F_%T)
categories: $_last
tags: ['']
image:
description:
---
<!--more-->
# Contents
{:.no_toc}
* TOC
{:toc}
# Support Me!
This post took XX hours to research, photograph, write and edit. If you appreciate the information presented then <a href="/DonateNow/">please consider joining patreon or donating!</a>
EOF
open _posts/$_filename.md
All the arguments except the last are the name of the post and file. The last argument is the category.
It then opens it, as I’m in OS X, in mac vim. I just hit the keys ‘Go’ (heh, funny) and start editing. Visual Studio Code.
I certainly could be done better, but I’m not a bash guy. This works for now and I can change it as time goes.
Updated August 3rd, 2017
See This post for more. Specifically the opengraph section to see how the image and description properties work.
Support me!
If you appreciate the information presented then please consider joining patreon or donating!