Skip to main content Skip to footer

Building a Green Blog

Welcome

Over the years I've written blogs for my company, Nexer Digital, Skrift and other sites. But the time has now come to create my own site to share my thoughts on and to use for development experiments.

The first choice was what CMS should I use for blogging? As an Umbraco developer and MVP, there was only one choice: Umbraco. It's built on the C# platform and is flexible and extensive.

The next decision was what design to apply. I am not a designer; and in my opinion people who can write CSS are pure geniuses. This meant I wanted an off-the-shelf theme that I could extend as required.  This means site is developed on uSkinned.  uSkinned has a lot of themes, and plugins and can easily be extended. It is also a delight to work with and they offer great support.

Hosting The Site

The next decision was harder, where should I host it. It's a blog after all, and at the time of launch had a handful of pages. Options included:

  • uSkinned: a full Software as a Service (SaaS) offering
  • Umbraco Cloud, Umbraco's, Platform as a Service (PaaS) offering
  • Hosting in a Web App in Azure, AWS or similar.
  • A static site.
Hosting

Go Green: Azure Static Web App

At Nexer we've been focusing on sustainability and I wanted to do the same with this blog. All of the standard hosting options need a database, media storage and a Web App. As there is currently no search or integrations, and as I develop locally, once the content has been created there's no need for a database. All of which make a Static Web App a valid option for my blog. I extended the package XStatic for Umbraco to export the site. 

There is a huge range of support for hosting a static site out there, for more information and for comparing options check out this stack comparison option.

I first tried hosting on Netlify however on deployment and testing through https://www.websitecarbon.com/ it was reported as not hosted on sustainable energy.

Next up I compared GitHub Pages to Azure Static Web Apps, as I do a lot of development work with these tools. As GitHub Pages and Azure Static Web Apps are both owned by Microsoft I expected no difference. I did no special configuration on deployment and tested against the following pages:

The results showed:

  • Azure Static Web Apps were consistently 1% cleaner and 0.01g lighter than the GitHub Pages. 
  • Speed comparisons made by looking at the network tab, showed that Azure Static Web Apps were consistently quicker to load.

The final test was to check how headers, such as cache-control can be set. Setting headers on assets not only helps performance, but also helps our sites be green. The lower the number of times an asset is downloaded the less bandwidth that is used.

  • Headers on GitHub pages are no configurable and Cache-control is set to 10 minutes, this does not provide the level of control that I feel a green site should support.
  • On Azure Static Web Apps, the cache can be controlled on a per page/ per asset type. Configuring cache control beyond on this site is still work in progress.

GDPR and Cookies

One additional bonus of using a static site, without plugins is that there are no cookies. There is (as at the time of writing), no tracking software on the site, and as static sites don't need cookies there is no need for a cookie banner.

Both of these have the added green benefits of no extra data being transferred to 3rd parties and no extra data being sent to users in the form of a cookie popup. The downside of this is that tracking visitors to the site has also been lost.

Summary

I have chosen to host on an Azure Static Web App. Choosing an Azure Static Web App over a static site in GitHub Pages does mean duplicating the content held, as it needs to be in GitHub before it is published to the Static Web App. But given the Azure Static Web App is slightly green in it's carbon usage and supports a green cache-control policy it is felt the greener approach. Especially as at the time of writing the static site the total size is approximately 19 mb as a web app the bin alone is 310 MB. Meaning when hosted as a web app it would use over 16 times more disk space just for the DLLs. 

References