About Publican
665 words, 4-minute read
Publican is a Static Site Generator (SSG). It takes content – typically in markdown files – and puts it into HTML templates to build a site. The resulting web pages are static HTML which can usually be hosted anywhere.
This site has been generated by Publican using code in the repository at github.com/craigbuckler/publican.dev.
Why not hand-code HTML? #
Your first website probably contained a selection of pages created in HTML files. Hand-coded sites rapidly become difficult to maintain:
- Common components such as headers and footers must be replicated on every page.
- Adding a new page requires updates to the navigation on all other pages.
- Moving pages or directories requires updates to links, images, CSS, JavaScript, and other assets.
Why not use WordPress? #
A Content Management System (CMS) provides administrative control panels. WordPress is the most well known and used by a third of all websites.
CMS authors write content which is normally stored in a database. When a visitor requests a page, the CMS retrieves its content, renders it within a template, and returns HTML to the browser.
This usually occurs quickly and there are ways to cache pages, but the downsides are:
- Performance and scaling. The server does considerable work on every page view so sites get slower as traffic increases.
- Multiple points of failure. Software updates or database downtime can break sites.
- CMS security. Unauthorized users could access and change site content.
- Resilience complexity. Back-ups, development, and staging builds can be difficult to manage.
Why use an SSG like Publican? #
SSGs such as Publican are a compromise between hand-coded HTML and full CMS sites but retain the benefits of both. An SSG extracts content from any source – files, CMS APIs, databases, etc. – and renders it in templates to create HTML files. This build process can run anywhere just once. The resulting files can be deployed to almost any web server.
SSGs offer CMS-like templating without the problems:
- Fewer constraints. You’re not tied to a specific CMS and can implement whatever functionality you require.
- Improved resilience. It’s easier to back-up or source control files and, if you’re using a CMS, it need not be accessible from the internet.
- Better security. There is little to hack. The worst someone could do is access your web server and change content – but you could re-render it within minutes.
- Better performance. The site will load faster because it’s pre-rendered. There’s no runtime processing so the server need only return files.
- Less downtime. A static site is less likely to fail because there are fewer dependencies such as server-side languages or databases.
- Lower costs. Static sites are cheaper to host and scale.
Does static mean limited? #
No. A static page means it’s been pre-rendered once rather than on every page visit. It doesn’t limit the features – you can still have interactivity, animations, videos, etc.
The main difference is you may not have server-side functionality. Features such as user login, form submissions, search, shopping carts, and user comments may require a different approach than a typical WordPress site.
I want to know more! #
Refer to the core concepts and documentation pages to get started.