By Darrell RobertsPosted: 03/06/2024

gov.uk - How to Build a Government Website

screenshot_govukgov.uk has an impressive performance score for a website that receives millions of users per month

First off, let it be said, as a British person, I am no great patriot of the United Kingdom. If I was, I wouldn't be living in Berlin, Germany.


Even so, credit where credit is due, and gov.uk - the UK government's website - is a masterclass of how to digitalise government services. And living in Germany, a country constantly grappling with digitalisation, the contrast is stark.


As you can see above, its homepage achieves an all-round 100 Lighthouse score. If you are unaware of what Lighthouse is, it is a google chrome extension that measures the performance of websites, based on: performance, accessibility, best practices and SEO. I've only seen this score on one other website, one that is quite "cough" familiar.


screenshot_darrellroberts

Just for clarity, a lower Lighthouse score is not the be all or end all, and is unrealistic for websites that require a lot of JavaScript. You can imagine as well, for websites that are scaled to withstand millions of visitors and need to fulfill multiple functions, it becomes harder to maintain a high performance score, as other issues such as bugs take higher priority.


All the more impressive then that gov.uk can achieve this score, considering that it is the A-Z for millions of Brits needing to, for instance: renew their passport, do their tax return or, currently, register to vote in the general election.


What surprised me most of all, is that it has its own User Interface framework, named simply: gov.uk Frontend. I'm not sure why to be honest this is in the public domain, and you can even access it through a GitHub repository, which includes instructions on how to get started. You can even contribute towards it as if it's an open-source project. Are they trying to encourage users to create their own imitation UK government website? But I digress. Within this framework it points to a JavaScript templating language: Nunjucks.


The benefit of using a templating language is that, due to its effectiveness in reducing code duplication and boilerplate, it can lead to strong website performance and faster response times. Another benefit is that it allows for greater reusability, particularly in the case of internationlisation and localisation (i18n), which mostly concerns translating a website into another language. It'll come as no surprise then that sections of the gov.uk website are available in more than 60 languages, along with English and Welsh.


Moreover, in its own style guide it makes a point of accessibility . Within this, it cites the four pillars of Web accessibility: Perceivable, Operable, Understandable and Robust; the principles of universal design; and how it measures and tests its own accessibility. To cite its own statistic, 1 in 5 people in the UK have a disability, therefore this is an important thing to consider when designing a website. From my own experience, too many times have I come across a website that breaks the Web Content Accessibility Guidelines (WCAG), by using, for example, the wrong font colour on a conflicting background. The fact that it not only recognises this, but makes a point of routinely testing its own accessibility, is admirable.


For me, gov.uk is the perfect example of how to digitalise essential government services. And it does this with a very no nonsense approach which is accessible to anyone.


So, like I said, I'm no fan of the UK but it's this love of digitalisation that sometimes makes me homesick.


Back to Blog homepage