Static websites in Golang and Rust

The website you’re visiting right now consists of generated static HTML files. This solution is incredibly simple - there’s no need for databases and complex web frameworks. It’s also very fast and easy to change whenever I want. However, it doesn’t use any of many available popular solutions for building static pages.

Building a static page generator

This website is generated by a small application in Go I have built specifically for this purpose. It lets me have exactly the features I need (i.e. just enough to produce the HTML pages but nothing that wouldn’t necessary). The project in question, called Scipio, is quite small but is able to generate the website you’re seeing, as well as other small websites: xstarter and SanchoSQL. Not focusing on just one website allows me to keep the application generic. The project is small at the moment but it can generate a website similar to this one, that is a combination of a personal page with a blog, but it can also fairly easily generate a good, old-fashioned home page with all kinds of files and custom layout. It also, as you can see on this website, create RSS feeds with recent posts. The content is added as Markdown files and theme files can use several simple variables.

Originally, I wrote it in Rust, mostly for the purpose of learning a new language. It was painful, as you would expect building even the simplest project in a new language. However, it was successful in a sense that this website was launched with HTML generated by that Rust script. However, when I wanted to add more features, I have decided to rewrite it in Go. It seemed like a great use for Go: it can generate pages pretty fast whilst allowing me to develop it quicker. So I pretty much translated the Rust code to Go. It went on smoother and quicker than I have expected. This is partly due to great Go ecosystem but also thanks to the fact that the Rust code I wrote wasn’t using any complex abstractions or advanced language features.

Future development

There’s a lot of improvements that can be made in order to make the project more robust. For example, current template files use simple variables to transform a template into output HTML. Extending the template language would allow me to avoid putting hardcoded content directly in a template.

Current ability to configure the output is somewhat limited so that’s where a lot could be improved. I’d also like to address other issues such as: ability to define error pages, support syntax highlighting, and add documentation.