Does Publican make your site fast?

By Craig Buckler

1,190 words, 6-minute read

performance
Image courtesy of Marc Sendra Martorell

Publican can build a site however you want. It primarily creates HTML pages (or mostly static templates), but you can add PHP code, frameworks, CSS, JavaScript, and any other assets you require.

This site – Publican.dev – is built using Publican. It implements web standards and best practice techniques to ensure the site remains fast, usable, and secure. The techniques can be adapted for your sites.

Pre-built server rendered HTML #

In previous years, there was a move toward Single Page Applications (SPAs). An HTML page – typically with no content – loaded JavaScript which took over responsibility for routing and content updates. This can have benefits for complex applications, but it often goes too far:

Few content sites need to be an SPA. Some complex apps can benefit from a simpler multi-page approach when users navigate to different sections.

I prefer a progressive enhancement approach to web development:

  1. Use semantic HTML to build a base experience.
  2. Add a layer of CSS to enhance that where possible.
  3. Add a layer of JavaScript to make further enhancements when necessary.

A site works on modern devices but will continue to work when something fails in old – or future – browsers. And something will fail for someone, somewhere, at some point. Progressive enhancement provides resilience.

HTML-first performance #

Web performance is generally woeful. The average page:

JavaScript is usually the main culprit for poor page performance. It may need to be downloaded, parsed, and executed before con tent appears. Developers often attempt to solve it by adding more JavaScript which compounds the problem.

It need not be that way. A typical page on Publican.dev:

Chrome’s Lighthouse tool and PageSpeed Insights give Publican.dev a 100% score for performance, accessibility, best practices, and search engine optimization on most pages.

Not all sites will have such low requirements. Publican won’t magically create a fast site, but you have full control over the assets you add.

User friendly #

Publican.dev strives to be accessible:

Device friendly #

Publican.dev works on most mobile, tablet, and desktop devices. The experience, text size, and layout may change, but content remains readable.

Printer friendly #

It’s unlikely you’ll print pages from Publican.dev, but press Ctrl | Cmd + P and examine the preview or save a PDF. Content is optimized for printing and will use considerably less ink and fewer pages.

You can usually make web pages printable with a few hours development. Few sites do?

Search engine friendly #

Publican.dev provides clean URLs, meta tags, structured data, tagged content, robots.txt, sitemaps, RSS feeds, and social media sharing. Good performance also influences search engine rankings.

A Publican-built static site won’t wondrously jump to #1 in Google, but there are no factors that could stop it happening.

Environmentally friendly #

The average web page emits 0.8g of CO2 per view. Many are considerably higher. Every year, that equates to an electric car driving 900 miles and requires five trees to absorb the carbon.

Publican scores A+ on the Website Carbon Calculator. It’s in the top 1% of sites, and emits 80x less than average with just 0.01g of CO2 per page view. The whole site requires one tree to absorb the carbon. My garden’s enough!

Security aware #

Publican.dev does not store session data or track users. It scores A+ on Mozilla’s HTTP Observatory tool which analyzes web security compliance.

The site is difficult to hack:

  1. It’s static HTML. There’s no server-side language, framework, CMS, or database.
  2. It’s served by Cloudflare Pages which provides a fast, secure, and scalable network.

The main risk is someone gaining administrative access to my Github or Cloudflare accounts. Even then, the site could be re-built and served from elsewhere in minutes.

Cost effective #

Hosting costs are – or certainly should be – minimal for static sites. You just require a server that can host files with enough bandwidth to cope with traffic.

You can still use a CMS and database, but that could be hosted on an intranet, your own PC, or even a Raspberry Pi without external access. The results of the build can be pushed anywhere.

Summary #

Web technologies have radically improved over the past decade. Sites need less code and fewer images than ever, but web page weight continued to increase. I don’t believe the average website has become more sophisticated – we’re just adding more unnecessary bloat.

We’re finally seeing a backlash against poor website performance. Static site generators such as Publican are key tools that could help.

Get started #

The Publican documentation provides a quick start guide, a detailed set-up guide, API references, and common recipes you can use and adapt for your own projects.