Hosting Hugo on Cloudflare Pages
Where to start…
First, the hugo site is stored in a git repository. I’m using Cloudflare’s Pages feature to host the generated code. My domain and DNS is managed there as well.
You need a domain name of some sort. Buy one from places like godaddy or namecheap. I’m not going to cover that part. You can also register one with cloudflare.
Then you’ll need to create an account at cloudflare where you’ll add your domain, obtain the nameservers to point your domain to, and once that’s done, you can start adding your dns records. Either by importing from the dns host you’re moving from or starting fresh. This page describes this process.
This here describes deploying a hugo site.
I would suggest using the envronment variable described on that pages page to match your local environment.
Now you can do what I do and run hugo in docker, it adds a little extra complexity but avoids needing to actually install hugo on your machine. I have a couple shell scripts in my repo that I use to do that. The server.sh file simply spawns a container to preview the site at localhost:1313. the shell.sh file gets you a shell to do hugo things like creating a site, and posts, and other things. Those mainly.