Navigating takes longer than writing a blog.
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:
- Open my blog repository.
- Type the above command.
- Open the newly created file.
- Write the blog content.
- Run
hugo -D server
to start a local server and preview the new blog. - Run
hugo
to build the new website. - 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.
- Open terminal
blog create
(creates new blog in my blog repository and opens in VS Code)- (writing the blog)
blog preview
(to run the development server)blog build
(to build)blog publish
(to push to the git repository)
you can find this script here