Jay 2 years ago
parent 9d0bb213a5
commit fedc30a92d

@ -8,6 +8,8 @@ excerpt_separator: <!--more-->
One thing I love about this setup is I just have to write markdown; and I can easily do that from my text editor in console. However it became apparent that I needed more stuff in my front matter than I thought; so I decided to automate things a bit.
title: Blog Composer Script
@ -18,11 +20,13 @@ excerpt_separator: <!--more-->
This is quite literally the front matter for this post. No, it's not a whole lot of information; but it would be really nice to just have all of that dumped in to a file right in to a ready-to-write state. Run a command and get to typing. This why we run Linux and self-host, right? To automate all the self-hosted things!
Well, that's why I do it. Either way, here's the bash script that I hastly hacked together:
# post composer
@ -56,6 +60,7 @@ mv $file $category/_posts/$pd-${t// /-}.md
printf "\nPost $title created in $category: $category/_posts/$pd-$\n\n"
Weeeeee, it's more comments than actual code; and it literally is just printing lines to files and playing fill in the blanks. Plus I don't think I have to write much more, it's already documented.
The only issue I had was when I had a naughty character in a title; so I may need to improve this by adding some stuff to escape those. You can use any editor you want. I'm just used to nano; and being even lazier; I wanted nano to drop the cursor at the *end* of the file. It's made dealing with the front matter sooooooo much easier. Template it once and fill in the blanks.