TLDR;
What is Hugo https://gohugo.io/ - “The world’s fastest framework for building websites”
Here’s the high level steps
- Download Hugo binary for your OS
- Confirm you can run the hugo binary
- Create a new site using hugo
- Initiate a new git repository inside your newly provisioned hugo site
- Push your new site to github.com
- Connect your Github to CloudFlare Pages
- Deploy your hugo site to CloudFlare Pages
- Test it’s available
Did I try using Docker?
Yes, Docker is the default answer to everything right? I discovered permission issues with the base setup when runninghugo new site <newsite>
, mounting the path as a volume and then trying to edit it in Visual Studio Code. Am sure there’s a way around this but for these first steps I just wanted a result. Hence the above approach using the locally run Hugo binary on my dev workstation meant permissions where simple and I could get underway quickly.
Here’s the detail
Download Hugo binary for your OS.
https://gohugo.io/installation
Precompiled Binaries here
https://github.com/gohugoio/hugo/releases/tag/v0.145.0
In my case I used the hugo_extended_0.145.0_darwin-universal.tar.gz
binary, but do what fits your dev environment.
Extract the binary to a folder
|
|
Confirm you can run the hugo binary
|
|
Which should give you this output
|
|
Create a new site using hugo
Run the following hugo
command to set up the directory structure and files in the my-new-site
folder.
|
|
This will then give the following output if successful
|
|
Initiate a new git repository inside your newly provisioned hugo site
Change directory to the my-new-site
folder
|
|
Then create a new repository and push it to the main branch
Go to https://github.com and create a new repository my-new-site
if you are following along with this guide. Otherwise substitute for your own repository name.
|
|
This will initalise the repository, add a README.md file and commit the changes to the respositories main
branch.
|
|
Push your new site to github.com
|
|
Will give you a result like this
|
|
You can then add the rest of the Hugo created files
|
|
Resulting in
|
|
then
|
|
Results
|
|
UNFINISHED BELOW
- Connect your Github to CloudFlare Pages
- Deploy your hugo site to CloudFlare Pages
- Test its available
Resources used
https://developers.cloudflare.com/pages/framework-guides/deploy-a-hugo-site/
https://github.com/CaiJimmy/hugo-theme-stack
https://github.com/CaiJimmy/hugo-theme-stack-starter
https://gohugo.io/installation
Future projects
- Publish the docker image for Hugo I created
- Publish a how-to using the above and a local docker compose example
- CF page with a custom domain