NEW! Stop and Start Series for multi-passionate content creators.

Updates on Bash Scripting for Hugo

Sun, Nov 4, 2018 | Read in 2 minutes

Clarity is an important aspect when starting any venture. Coding and/ or web development is no exception. Hence, I’d like to lay out the concept of what I’m trying to make.

I am using Hugo as my static site generator on top of a private GitLab repo. I’m also on a Mac so, whenever I create posts, I do so locally and then push them to my repository.

My goal for this yet unnamed, simple bash script is to automate the process of creating a post in the content/posts folder of my site.

Through automation, I’d like to achieve the following:

  1. Create a new post (or markdown file) inside content/posts with the filename set to YYYY-MM-DD-Title (e.g.
  2. Automatically insert front matter inside the new post (e.g. title, subtitle, etc.).
  3. Automatically add current date and publish date (for future posts) in the front matter.

To do so, my script follows this process:

  1. Ask user to enter the Post Title
  2. Ask user which site (for multiple sites) to add a post to.
  3. Create a new markdown file inside the indicated site with the filename as current date and post title.
  4. Start writing the new post.

So far, my script has been doing what I want it to. Now, in order for this to be open source-friendly, I will have to add some useful variables and comments so people can just enter their details if they want to.

That’s it for now. 🙂