After many years of dealing with dynamic, database-driven websites, I have decided to move my professional website to a static site using the Hugo static site generator. In the process, I wanted to simplify my hosting and design philosophy for this site. I decided on two requirements.
- I want the site to be hosted as a static site from cloud storage (AWS S3 for now).
- I want the name resolution (DNS) and Content Distribution (CDN) to be handled by a third-party (Cloudflare for now). This will make it easier to move my website to another cloud provider should I need to do so in the future.
With these two requirements in mind, I set out to make my new site. With a static site, all I really need to do is configure the S3 storage for static website hosting and upload the files. However, I want to version control my files with git and automate the process of sending them to S3. Let’s take a look at the publishing workflow.
My Hugo Publishing Workflow
- Write the post or webpage using a markdown editor. Sometimes this is Obsidian and sometimes this is iA Writer depending on what I am posting.
- Preview the post and if I like it, I commit the changes to my local git repository and then tell Hugo to build the site.
- Push the changes to my remote GitHub repository.
- A GitHub action is used to then upload the “public” folder for my website to an Amazon S3 Bucket.
- Now my new post or webpage is in my S3 bucket.
- The public can access my website over the internet. (* Note in the diagram that DNS and CDN is provided by Cloudflare so I can move my website to another cloud provider should I need to in the future.)
Now I have a fast, reliable, static website that can easily be changed or added to using plain-text markdown.