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:
- Create a new post (or markdown file) inside
content/posts
with the filename set toYYYY-MM-DD-Title
(e.g.2018-11-04-Updates-on-Bash-Scripting-for-Hugo.md
). - Automatically insert front matter inside the new post (e.g. title, subtitle, etc.).
- Automatically add current date and publish date (for future posts) in the front matter.
To do so, my script follows this process:
- Ask user to enter the Post Title
- Ask user which site (for multiple sites) to add a post to.
- Create a new markdown file inside the indicated site with the filename as current date and post title.
- 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. 🙂