~chrono/archive/
Automating the creation of this blog

Released: 2021-03-09

As the title said, I have been playing with some bash scripting since I was kinda bored. I was thinking about a blog made by Kev, where he expressed how he moved away from Jekyll and back to WordPress. Now, I have never used WP, so I don’t really know how many advantages, besides the mentioned in his blog, it has.

But that blog helped me to see, and recognize some of problems and annoyances I have with my current workflow.

Recently, I started to use Neovim to make my blogs, like the one you are reading right now. And since I am already trying to be as minimal as possible, I decided to make a script that helped me do the following things

  1. Create a post file
  2. Name it and add its date
  3. Add the metadata to it
  4. Open it to start editing

Doing scripting stuff (Not a tutorial tbh)

So, doing a script on linux is kinda easy, because of the way UNIX like systems work, I can make use of small utilities that can do small things and wrap everything together to make new useful scripts to automate the little things. In my case, I made something like this.

#! /bin/bash
echo "Type filename"
read name
filename=$(date +"%Y-%m-%d"-$name)
touch /path/to/_posts/$filename.md
printf '%b\n' "$(cat /path/to/_template.md)" >> /path/to/_posts/$filename.md
alacritty -e nvim /path/to/_posts/$filename.md

A quick explanation

Wrapping up

And that was it! I actually managed to do it. I am not sure if I could make it even simpler, but I am happy with the result. I can now start my blogs in a better way than before, where I copied and pasted everything from a previous file, that I had to open and close and I also had to be type the path of the file and make it and all of the usual stuff. But hey, now it’s everything automated for me!

Also! I also made some changes to the font sizes of this blog, and other CSS things, just because I felt that everything was a little too big, and I didn’t feel like scrolling that much just to get past the title. I think I still have to tweak it a little bit, but it is a good start.

This was day 23 of #100DaystoOffload, let me know if you found this kinda useful for you too. Or if you have a better script or anything that you use to make your blog workflow better!