8. What are Static Site
Generators?
Credit: Photo by Fatos Bytyqi on Unsplash
9. Three technologies which make the difference
1. Git
• stable, sophisticated, free version control technology which is ubiquitously
supported
• github: global scale infrastructure providing git as a service
• allowing distributed contributions by 'pull request’
2. Markdown
• simple, parseable but easily readable plain text format
3. Static Site Generators
• a new class of tool to manage content locally and compile it into webpages
which are then uploaded to a server (kinda like we used to do it in the early
90s!)
10. General characteristics
• a desktop application which assembles content from simple text files and
publishes it as static content to a bog-standard web-server.
• content is processed during the publishing operation, rather than when the
user requests content (although client-side Javascript still supported)
• simple command-line application to generate content and serve pages locally
(replaces the need for a staging server)
• no database - content in semi-structured text files
11. Components - standard to most systems
1. content-model
• folder hierarchy, text files
2. content pages
• (markdown, front-matter)
• blog type content is also often supported
3. templates (& themes)
• (with some level of basic scripting)
4. generator software
• typically a command-line script or application
5. configuration file
6. other non-core features
• 'shortcodes'
• data as content (i.e. data in structured files such as JSON or YAML)
• plugins
13. Under the hood - a
case-study: the
Dublin Core website
and Hugo
Credit: Photo by Hosea Georgeson on Unsplash
14. About the Dublin Core Website
• in continuous operation
for ~25 years
• approx 2,500 web-pages
with 3,000 other files
• 18 month project to
convert to Markdown
• compiles with Hugo from
sources in < 2 seconds
• averages 100,000 page
views / month
• running on a web-server
costing $5 per month
15. About Hugo
• second most popular SSG
after Jekyll
• the fastest SSG (written in
Go)
• simple installation - just
download and run
(Windows, Mac, Linux etc)
• very actively developed -
improving all the time
16. Content-model
• text files arranged in folder
hierarchy
• folder hierarchy relates to URL
path structure
• filename relates to URL
17. Content pages
• "front-matter" metadata
• often in YAML format like here
• main body in Markdown, arbitrary
HTML also accepted where necessary
18. Templates
• can reference metadata (e.g. 'page
title') from content page
• can re-use 'partial' templates (e.g. a
common 'header' & 'footer')
• (example here is in Go's templating
syntax)
19. Command-line software
• used to generate new content:
• also used to run a local sever to see how the site will look
20. Deployment options
• SFTP
• Rsync (over SSH)
• git commit hooks (or
GitHub webhooks)
• requires the site
to be built on the
server, so a little
more
infrastructure
required
24. The sustainability headache
• ~50% of WP installations are at
least 3 versions behind the current,
at the time of checking this (2019-
06-25)
• to maintain a website, the software
has to be kept up-to-date (web
server, database software, PHP,
Wordpress, themes, plugins....)
• Funder now require project websites
to be sustained for longer periods
(10 years!)
• backup and long-term preservation
is very difficult
• typically need to preserve
complex software & a database
https://wordpress.org/about/stats/
25. The security nightmare
• WordPress is the most widely used
CMS in the world, powering over 25%
of websites with almost a 60% market
share of traffic.
• This attracts bad actors
• 14034 vulnerabilities (3129 uniques)
• 28 new ones added in the last month!
• a whole industry for protecting just
Wordpress!
https://wpvulndb.com
https://www.wordfence.com
26. So, why use a Static
Site Generator?
Credit: Photo by Fatos Bytyqi on Unspla
27. When to consider using a Static Site Generator
• if you need to build & manage a website which:
• will have one, or a small number, of users
• will be relatively simple
• won't have major 'dynamic' requirements
• will need to be preserved, even after it is no longer a live site
• a project website is a good candidate!
28. Simplifying curation and preservation
• version control and redundancy
• synchronised repositories & distributed version control via Git
• active curation
• ease of access and contribution to sources via Git
• simple & readable plain text formats (Markdown)
• "one click" deployment
• minimal deployment infrastructure
• standard web-server
• text files, open formats, no database or server-side 'logic', static site
generators
fewer broken websites!
30. Summary: pros and cons
• Pros
• can manage many contributors,
with different levels of access
• (non-tech) user-friendly
authoring env.
• Cons
• significant sysadmin burden
• infrastructural reqs
• plugins make this worse
• content preservation challenge
• harder to scale
• challenging to keep secure
• Pros
• minimal infrastructural reqs
• minimal sysadmin burden
• easy to keep safe and secure
• supports content preservation
• very responsive websites
• scaling is not really an issue
• no need for staging server
• developer-friendly authoring env
• Cons
• basic access control (e.g. git repo)
• less user-friendly authoring env.
Content Management System Static Site Generator
32. Paul Walk
Founder and Director, Antleaf
Dublin Core Metadata Initiative (DCMI)
Web: http://www.paulwalk.net
Email: paul@paulwalk.net
www.antleaf.com www.dublincore.org
Thank you!
Editor's Notes
The era of the enthusiast
Single person responsible for the website, authoring, designing etc.
Single person responsible for the system
Using tools such as Dreamweaver or Microsoft Word.
Very few moving parts, quite reliable, limited functionality
The era of the CMS
Team of people responsible for the website, many authors
Directly on the CMS, via a web-browser
More moving parts, functionality but also complexity, much more support needed.
Wordpress is one of many available CMS
The era of the project website and the Static Site Generator
Started by Jekyll for GitHub
Back to basics
contrasted with a 'Content Management System', which typically assembles and pre-processes content on request
not a new idea (this is where we started with the Web!) but it is much better supported now that we have things like distributed version control (e.g. git) and useable markup and presentation languages (e.g. Markdown, HAML etc.)
463 static site generators
This is the DCMI sources on Github
text files arranged in folder hierarchy
the folder hierarchy normally conveys some meaning, and relates directly to URL structures
This is the source file in a simple text editor
the new content will use the appropriate 'archetype' according to the path - in this case a 'news post'
the browser refreshes the content as soon as you save any file (content or template)
the workflow become editing simple, easy to read and write documents, committing changes with standards git commands. This triggers a GitHub web hook which causes a web server to re-generate the resulting website.
This is an awful lot of complexity if you just want to deploy a simple website
Too many moving parts
replication for resilience and/or scaling is non-trivial
speed!!
shifts the burden from the point of viewing the content to the point of publishing the content
In short, Static Site Generators can give you peace of mind