Deploy Hugo on Github
This is connected to this other post, about Hugo!
When I decided that I wanted to use Hugo for my blog, I faced the question of “just how to I deploy this thing??”
While Jekyll what is easy to deploy (by simply using github desktop) Hugo was… not. They do have these very detailed yet very confusing set of instructions on their website, but they don't help all that much.
As somebody in some forum pointed out, they're written by developers for end-users, but not by end-users for end users. So a lot of specific steps are missing.
After much fucking around, I got it to work. Obviously. You're reading it right now! As I could not find the following steps in one place, here are the three guides that made this possible:
For Hugo I followed this guide updating the config.toml or the config.yaml and adding
publishDir = "docs" deployed from the docs folder of the repository.
[screenshot showing Visual Studio Code and the config.toml with the code above]
On Github you set the repository to deploy from docs:
[Screenshot showing Github settings for the repository set to deploy from docs.]
That works and it deploys to: https://brimwats.github.io/musings/
For Reclaim/Shared Hosting that uses cPanel I followed this guide
You do this by going to the ‘Zone Editor’ (don't create a subdomain! this will cause the Zone editor to error out)
In the first field you put ‘subdomain.yoursite.com’. For me this was ‘musings.brimwats.com’.
The second box is not the full github URL. Instead it's just ‘GitHubUsername.GitHub.io’ for me this was ‘brimwats.github.io’
Next, you follow this guide on GitHub and set the custom domain in the project to ‘subdomain.yoursite.com’. For me this was ‘musings.brimwats.com’.
[screenshot showing “Custom Domain” in GitHub Settings set to appropiate domain]
Best of luck Hugo-ing, Victor!