This portfolio/blog website is powered by Hugo and PaperMod Theme. If you have built something using Hugo, then you know that to create a new post, you have to write this command.

hugo new content content/posts/<post_name>.md

To create a new blog, I would have to follow these steps:

  1. Open my blog repository.
  2. Type the above command.
  3. Open the newly created file.
  4. Write the blog content.
  5. Run hugo -D server to start a local server and preview the new blog.
  6. Run hugo to build the new website.
  7. Finally, push the changes to my remote host, GitHub. This will publish my new blog.

I found it difficult to deal with writing out numerous commands, so I decided to create a custom bash script to handle these tasks and free up my time to focus on writing the blog.

Unleash the power with a Bash script!

I have created four commands, as you can see below. Each of these four commands has a specific purpose. For example, the create command will change the directory to the blog repository and create a new blog at a predefined path. The preview command will run a local server to preview the site. The build command resets the public directory. The publish command pushes changes to GitHub and Vercel builds a new site.

So now I write these commands to publish new blog.

  1. Open terminal
  2. blog create (creates new blog in my blog repository and opens in VS Code)
  3. (writing the blog)
  4. blog preview (to run the development server)
  5. blog build (to build)
  6. blog publish (to push to the git repository)

you can find this script here