48 comments

[ 2.7 ms ] story [ 62.9 ms ] thread
Author of the blog here in case anyone has questions.
Kinda curious why you did not go with OpenResty?
I am more familiar with Caddy and The way OpenResty uses Lua was never very clear to me in my cursory 40 minutes attempt to use it.
I miss the days when "implement your own blogging engine" was one of the most popular learning projects for engineers.

We should bring that back! Its such a great way to play around with client- and server-side development options in an almost zero-risk environment.

I suppose it's because fewer people have personal web sites these days?

What is the typical learning project these days for beginners of a programming language?

I keep thinking a nice client app that is mostly working against a directory of markdown files that "publishes" to an option of fastly/denoland/cloudflare as mostly-static content would be a pretty nice option.

The blog/data directory can be backed up or even using a github repository for long term raw storage.

I'm not a fan of having the same site/application for rendering as editing the blog as it tends to become too much of a big/easy target... ie: Wordpress, how much internet traffic is script bots trying WP exploits?

I don't know man, every time I tried to learn Lua (to write nvim plugins and HammerSpoon spoons) I disliked the ergonomics of the language. I don't understand why people say it's an easy language—

    easy ≠ simple
It all depends on what you been exposed to in the past, right? I find Lua simple because it is a minimalist language in which there are very few things to learn. You can buy "Programming in Lua" for the version you want to use and with a single book you learn about basically all of the language and its internals. That is not the same with some other languages.
I spend a lot of time blogging but all I use is a ~50 line Python file that converts my markdown pages to HTML, adds my template, and generates the ToC page. Then I push to GitHub Pages.

I can't imagine needing more than that. Why are these blog stacks so complex?

I had a similar setup in the past. The current stack can be explained by:

1. I don't want to rely on any external SaaS but my VPS. No github action to rebuild the site or anything like that.

2. I want to be able to post from multiple devices, which means that SSGs add more friction cause I'd need to make sure the source is up to date on all machines I am trying to post. It is not a hard problem, but opening an editor online and posting is much easier. The key to blogging is reducing friction.

I use perl for the same reasons. The few dynamic scripts that I need I want to write and forget them for years. Odds are with perl they'll still work 20 years from now.
You could also do something like this, have Caddy webserver parse your md files through a template

https://github.com/dbohdan/caddy-markdown-site/blob/master/C...

^^ the above combined with caddy git fs to have your md files cloned in memory and refresh every X interval is kind of magical. Git push a new md file and wait X minutes and your website updates.

https://github.com/mohammed90/caddy-git-fs

====

Or a one-file FastHTML (python web framework) solution:

https://gist.github.com/simonMoisselin/f63c52f087704c99b6a62...

LuaJIT is awesome.

I've been converting my Bash scripts/functions to it, with much success thus far.

https://redbean.dev/ could be just perfect fit for you
I tried it in the early days but couldn't get it to work on my mac. Also, I'm very familiar with Lua source code and LuaRocks so I chose comfort. Redbean is amazing though and I really want to take it for a spin some day.
I liked this post, and I can totally understand where you’re coming from…

But couldn’t anything you say about Lua also be said about JS? You mentioned how Lua wasn’t batteries included, so you try to limit your libraries. Couldn’t you say the same for JS? JS itself doesn’t change much, it’s the ecosystem. Couldn’t you just pick out some small and stable libraries the same way you could with Lua?

I love JS, don't get me wrong, I absolutelly love Javascript. But I love the JS that the browser runs and understands. I hate the current ecosystem of bundlers, transpilers, typescript, npm modules and so on.

Yes, I could have picked a js runtime and done the same thing. The same thing could also have been done with literally any other language.

It is less of a "Only Lua Can Do This" situation and more of a "I Like Working with Lua" situation.

I've been thinking of how to make a blog simple recently, and I came across xslt. It looks really cool and seems pretty set in stone, so I thought I'd ask, what are the advantages/drawbacks of making your own tech stack versus xslt? At first glance, it seems perfectly able to handle rss and other simple linking patterns, and pretty much anything can easily be turned into an xml then xslt could be used to generate an html (server-side, or rather writer-side, not like the blog is gonna change) that you serve?
waldium can be good for blogs if you dont want to do a custom build. its geo-specific though
ha - I'm well behind you trying to get my blog from Mullenweg hell to pure Raku
Lua 5.1 to 5.2 was a fairly significant breaking change; one that has forked the community to this day with luaJIT never coming on board. 5.2 to 5.3 also broke things with the introduction of integers but mostly at the level of bindings. There is also very little included in terms of standard library and while luarocks exists many significant packages go abandoned. There are breaking language changes in the upcoming 5.5 as well though they are relatively minor.[1]

All to say I think if long term compatibility is the primary goal there are probably better languages.

Have you already discounted php or perl?

[1] https://www.lua.org/work/doc/manual.html#8

Be aware that Lua doesn't use semver and that versions take many years to be ready. In this page:

https://www.lua.org/versions.html

You can see that between 5.3 and 5.4 there were five years. 5.2 to 5.3 was also a five years gap.

Breaking changes are well documented and we see them years before they happen and nothing requires you to upgrade.

Most code runs on 5.1 forward.

What’s their reason for not using semvar?
I manage to embed lua into my project. https://rapidforge.io its incredible language I don't understand why would you need dsl if you have something like lua to use
I love the Lua language, has all the nice to have data structures, no need to think about memory management, is straightforward (keep the whole thing in your head easily) and will go forever without changes. Just stick with v5.1.

It’s so cool to take the interpreter source, type make and be using it in one minute.

I worked with Lua for awhile but never got over the 1-based indexing.
You very seldon need to deal with it, most of your iterators are `pairs()` or `ipairs()` anyway. I like 1-based indexing and can deal with 0-based ones without any wart. I don't really get it why people make so much fuss, but then again if you feel it is a big problem, then there are plenty of other options that will suit you better.
You'd get used to it eventually. Many of us had to go the other way. I grew up with BASIC and Wirth languages (Pascal, Modula-2, etc) that were 1-indexed and to this day even after 25, 30 years of working professionally in 0-based indexed languages I still catch myself here and there having to adjust (and whiteboard coding can sometimes throw me off under pressure), but clearly operate just fine.

I worked briefly professionally in Julia a couple years ago, which is 1-indexed, and I found it an easy transition, really. Many scientific computing things are 1-indexed, as Fortran was, too, among other reasons.

My own project is a rewrite / defibrilation of the 1990s LambdaMOO server (https://codeberg.org/timbran/moor/), which had its own OO programming language that was 1-indexed.

It's just not as "weird" as people think, I think it's just a generation of people grew up with C-derived languages and have grown to expect 0 as "normal" when it's really just "accident of history/popularity". I don't think it's objectionable that Lua chose 1-indexing, it is actually more "friendly" to newcomers to programming.

> Your blog is your place to experiment and program how you want it.

I guess this is his why ;-)

Love the author's mentality. While I would almost definitely not pick Lua (I'd probably pick Go), I like how they arrived at their decision. Nicely done.
thank you! Go is such a nice language (but then again, I love Pascal so Go feels quite familiar).
I am not sure why one would have to use an engine for this. A blog consist of mostly repetitive list of posts made from a single identical template. Any 10y old kid could just master it enough to write them in html directly. And pandoc is just installed in seconds from any package manager if one wants to use an even easier different markup language. Heck in age of microblogging and social medias most blogs aren't even seeing a new post every week, barely anyone is on dialup anymore[1] and those who do probably won't load images automatically, one could have all their posts in a year on a single html page and just anchor tags. This is certainly the case from the blog linked here.

A shell function is enough to call pandoc, update any kind of index (date or tag based) and an rss page really. I would hardly call that an engine, it is just an helper to not forget to update indexes and feeds.

[1] loading speed was the main reason blog engines used to split posts in single pages

The reason it has an engine is because it also has an interface for me to post and admin stuff. The previous version was generated by scripts (using Racket and not Pandoc) and that made it harder for me to post from devices that were not my own main computer where the source lived. For example, I like posting from my phone.

PS: I'm the author.

As a a javascript dev I kinda feel you and agree that the tools are moving faster than most codebases. The thing is though, you don't really have to use that many tools unless you really want to.

You can spin up a node server yourself and use web components and it will run fine probably just as long as the lua code will. It's also way easier today to just use web components and not any framework since LLMs can help you speed up the development.

I am extremelly biased against LLMs so take my opinion with a grain of salt. I opted to run a CGI script instead of spinning my own webserver cause webservers are tricky. I'd rather run something like nginx or caddy. I like nodejs (my preferred JS engine will always be Mozilla's and for the terminal I been favouring Bun) but part of using Lua on my own blog is cause of JS fatigue. I'm exhausted with the JS workflow these days.