Creating the website, again...

Tags: luatechnology

I've been thinking about recreating the website again. I'm not talking about the content, but the way it gets generated from plain text files. Given the obstacles I've been encountering with Hugo and the fact that I didn't create it, I started to work on a prototype for a markup language and a document converter.

I chose Lua to be the backbone of this new project since it's lightweight and fast for an interpreted language. I can easily modify the code and extend it. The biggest downside is that it's lacking in frameworks and libraries. I don't mind that, I can always write my own stuff from scratch; it's part of the fun.

Who knows, soon I'll be satisfied enough with this project so that I can ditch Hugo and keep my perfectly imperfect solution for this website, and others that might come in the future. I'm making this for a personal website after all, so the tools used to create it must be personal too, right?

How does it work? (or how it will)

The markup language

It's pretty similar to Markdown, since I'm used to writing it. But I wouldn't call it a Markdown flavor. Its implementation is very simple. For example, it doesn't allow nested inline styles. It's similar enough that all my notes and posts can be converted to this new language with minimal changes. I don't want the code to become very large. It should remain relatively simple and easy to modify.

Originally I was going for something like Gemtext, but it was too restrictive.

Document converter

Markup in, HTML out, or any other format, but I'm implementing HTML for now. This works like a simple text filter command, so you can already make a very simple website with this. It's not enough for websites that require templates, or indices.

Template engine

Takes a template file, or chunk of text, and replaces syntax like {{ func() }} with the result of evaluation the Lua expression contained within. Conditionals and looping are supported.


Some pages are an index of more pages. Like a blog, or the table of contents of a large document. This requires a program that takes a list of files and generates a variety of indices:

This can also be used to generate RSS files.

Multilingual support

Translated pages will be linked together so that hyperlinks between then can be generated.

To be honest, I took many of these features from Hugo, features I really like. But now that I have implemented them in my own way I can make them work the way I want.

It's a difficult problem to solve, wanting a simple framework with a small codebase but robust and flexible enough to accomplish all these tasks. Lua once again shines in this aspect: A simple, minimalist language that can be extended on the fly.