Hugo - Awesome Way to Enjoy Blogging as an Engineer
I have just finished migrating my blog from Ghost self-hosting to Hugo. I am more than happy to use: { framework: “Hugo”, hosting: “Firebase”, cicd: “CircleCI” }. I just wanted to share the full process of how I got it done, which was not a piece of cake. You see, it’s not a toy project, it’s real one. There are plenty of great resources available that explain how to setup Hugo, install Hugo themes, and so on. In this post, I will focus on the challenges I faced during this migration.
When you run the hugo server
command on your local machine, it seems to work flawlessly. However, when you try to deploy it to the cloud, the first issue you may encounter is the baseURL
setting in the Hugo config file. Here is a portion of my config file that pertains to this issue:
|
|
The main point I want to make is about the first line. It allows us to use any hostname as a baseURL
so that stylesheets and other assets can have a correctly accessible URL.
The next step is to configure Firebase deployment. You just need to set up your Firebase hosting and test if it is deployed correctly, which is pretty straightforward.
Here is my firebase.json file:
Here is the list of Firebase CLI commands used:
And the final point is here in CircleCI config(.circleci/config.yml
) file:
|
|
As you may have noticed, you need to add the $FIREBASE_TOKEN
as an environment variable to your CircleCI project settings. With this setup, you can blog anywhere using your favorite editor (hopefully VIM!). Once you push your new content to Git, it will be live in less than a minute thanks to the CircleCI pipeline.
I apologize if my explanation lacked some nitty-gritty details.
Happy blogging! 😎