1. 51
  1.  

    1. 6

      Very cool! I use Lua for my blog as well, but only as a static site generator.

      Another “Lua on the web” fun fact is that itch.io is powered by Lua via lapis

      1. 1

        I too, use Lua for my blog but only for configuration.

      2. 5

        Huh, was surprised it’s not a static site generator, especially in a post about keeping things easy to maintain. Love the ethos here though, and JS (the ecosystem, not so much the language) is indeed exhausting.

        1. 6

          It used to be a static site generator but I was having trouble posting to the site from my tablet and phone. I had macgyvered a micropub and metaweblog api server that would save the file and trigger the generation again but it was quite clunky.

          CGIs are very easy to maintain. They get the job done for small sites like mine pretty well.

        2. 4

          I use Lua 2.5 during my blog generation! Talk about stability.

          Soupault, the static site generator I use, is made extensible with an embedded Lua interpreter. A user can write Lua scripts to provide functions on top of soupault.

          Soupault is written in OCaml. It embeds lua-ml, a Lua interpreter designed to be embeddable in OCaml programs. But it only supports Lua 2.5, which doesn’t even have for loops!

          But it gets the job done. And the scripts stay fairly comprehensible too, like the script I wrote to populate all posts with metadata.

          1. 2

            Haven’t used that version of Lua. Think my first one was whatever came with cgilua. Probably 5.1 or 5.0. Soupault looks really cool. That script is so clear. Really like it. Those while loops made me giggle here.

            1. 1

              Yeah. I like the recommended (in Lua 2.5 reference manual) while loop approach to iterate over a Lua table:

              local i, v = next(t, nil)
              while i do
                  print(v)
                  i, v = next(t, i)
              end
              

              I also love the multi-line string syntax. I use it to add an HTML snippet to qualified posts.

              local s = [[
               <aside>
                <details>
                 <summary>What's a mental model?</summary>
                 <div>
                  <p>Bla bla bla</p>
                  <p>bla</p>
                 </div>
                </details>
               </aside>
              ]]
              
          2. 4

            I keep reading of such things, but they are all way more complex than I want. Databases, code that extracts stuff thence, etc.

            I just want a plain old 1990s web site made of flat HTML with no code in it whatsoever, kept in a filesystem, and some tooling to make that easier to maintain. Maybe even Markdown instead of HTML.

            1. 2

              My websites are all just a bunch of HTML files and associated images, etc. The only tooling I use is my text editor and then ftp or rsync to upload the files to the server.

              The only thing that’s annoying to maintain manually is an RSS feed. At some point I’ll get around to writing a script to automatically generate a feed file. Or possibly not.

              I have tried quite a few static site generators - my favourite was sblg - but, other than the RSS feed, they all seem like overkill.

              For a multi-person blog or a newspaper or something else with multiple contributors, perhaps with varying levels of tech savviness, then I can see the point of a CMS. For a single person’s website, I’ve never found anything that beats Notepad and an FTP client.

              1. 1

                That’s how I built it 29 years ago, yes, but life’s too short now.

                1. 2

                  I started that way … wow, yes, about thirty years ago … and then migrated to various static site generators, supposedly to save time. But then I realised that I was spending significantly more time wrangling the site generators than I ever used to spend doing things manually. Hence my return to just editing files myself: I do that in 2025 because life’s too short!

                  1. 2

                    Oh my. You confirm my darkest fears. I am dismayed.

              2. 2

                You’re describing ikiwiki (where the “wiki” part is entirely optional)

              3. 4

                Keeping the entire system in your head is an unappreciated superpower. I love creating systems that either minimize dependencies, or choose dependencies that excel at conceptual compression so that I can reason about an entire application (at least at a high level).

                1. 3

                  I don’t need to serve that many requests though. My peak access was a couple years ago with 50k visitors on a week

                  Have the ai scraper bots not found you yet?

                  1. 3

                    Think the locusts moved on by now. Fingers crossed.

                  2. 3

                    Given that you used to use Pollen/Racket, did you think about using Fennel here?

                    1. 2

                      Good call, vendored all the stuff I depend on (which is not much, really)

                      https://github.com/matklad/matklad.github.io/commit/912a342e3a3d7e2581d4ea1679e6dc2305b1b60b

                      1. 2

                        You might enjoy exploring OpenResty. LuaJIT (so only 5.1, shrug) embedded in nginx. All the fun of lua but also stupid fast when JITted (in prod via a simple config switch), and integrated with the webserver so operationally trivial. And you can throw a lot at it without it breaking a sweat.

                        1. 6

                          It’s worth checking whether luaJIT is actually faster for your use case. I’m using Lua for the document compiler that takes semantic markup and runs a bunch of passes to generate HTML, ePub, or SILE from my latest book. I’m using Sol3, which makes it trivial to switch Lua implementations. I found luaJIT was marginally slower. The Lua interpreter is impressively fast in recent versions (in a normal build, 90% of the time is spent in libclang, so I skipped that pass when testing the different implementations).

                          1. 1

                            Ah that’s interesting. OpenResty uses a separate “branched” version of luajit, which is claimed to solve some performance issues. I’ve never compared because the OR one is great for my purposes, would be interesting (out of curiosity) to know more, if anyone did further investigation!

                          2. 4

                            I played with OpenResty in the past and with some cool Lua/Moonscript based web frameworks. They are really cool. I decided they were overkill for my blog.

                            1. 1

                              Good call, very much in the spirit of your blog post :-)

                          3. 2

                            How exactly is your sqlite data stored? I’d be interested in seeing it! (For example, I’ve been considering using the sqlar format to simulate a filesystem.)

                            I’ve been too busy (procrastinating) to redo my personal website again, but this is exactly the type of approach I’m going to use. I think there’s a lot of resurging interest in making small things for personal or small-communal use, just for fun, “enough for what I need”, and I love seeing it. My previous attempt is an unholy POSIX sh script that’s a port of a similar plan9 rc script, and it definitely shows; the static site generation aspect makes it hard to update, as you mention, thus the interest in making something dynamic and simply “synced” rather than VCSd.

                            1. 1

                              Impressive write-up!

                              For some reason, I saw that other readers liked your post, but I didn’t see a “like” button anywhere

                              1. 1

                                Thanks for the kind words! The likes come from social networks, most of the likes you see there are coming from Bluesky. I posted a link to the post there and people liked the post. I collect these likes using Bridgy which then sends WebMentions to my website.