1. 23
  1. 8

    m4 is another wonderful little POSIX utility great for blogging, and it ships with most Linux distributions by default. Phil Hagelberg’s entire site is “published via GNU M4, rsync, and a 12-line Makefile.”. If you’re into keeping it simple, this thing is definitely worth a look!

    1. 2

      M4! That’s a blast from my past: been there, done that. Before switching to m4 I used Make & CPP for a while. I’ve used many different approaches in the nearly two decades since that though!

      1. 2

        What does your process look like nowadays?

        1. 2

          I’m currently all-in on Emacs Org mode, which supports publishing static websites. I have CircleCI automation to generate previews, as you can see here. My Emacs config also has some specific blogging support. (Including duplication of the publishing spec, which I’m not too happy about.)

      2. 2

        Hi! dozens / chrisman here. Thanks for the link.

        Yeah, I just discovered m4 rather recently. Nifty little tool to be sure!

      3. 5

        Good post but it ignores the only nontrivial part of this setup: feed and listing generation.

        1. 2

          I just recently set up a blog similarly and the most significant portion of time was spent with index generation and how I wanted to do it. Between that and CSS twiddling I’ve almost gotten around to writing another post!

          1. 2

            Why nontrivial? This can be done even in a Bash script. Generating a XML (RSS, Atom…) is very easy. You need to write only one simple function to do proper escaping.

            Reading XML (or even worse HTML) is more difficult. But in case of a simple generator for a personal website, I can imagine this done through one regular expression to extract the article titles (yes, not every valid XML/HTML could be parsed this way, but because it is your website, you can write pages that are parsable this way). Date can be obtained from the filesystem metadata or the version control system.

            Of course, more robust solution is a XSLT (the dependency graph is quite small). I do it this way (make + xsltproc or ant + Java).

            1. 2

              It’s nontrivial if one of your goals is to avoid a general-purpose programming language, but re-reading the article I can see that it doesn’t appear to be one of their concerns; I must have read more into it than was intended.

          2. 3

            I did something similar to this a while ago. This one seems much more featureful though, and supports RSS.

            Since then I have switched to using ssg, mostly so I can also use rssg to generate an RSS feed.

            1. 3

              All I have to do is send an email to an address I set up and my blogging engine will add it to the blog, which automatically adds it to the archive and generate the four feeds I have (RSS, ATOM, JSON and one for gopher). Oh, and I set this up 20 years ago (well, RSS, ATOM, JSON and the gopher feed are relatively new additions, all things considered).

              1. 2

                I’ve done that for my blog (no more active). Here’s the makefile. I use shell/sed scripts to generate the index, rss and check HTML/CSS/RSS validity. It is deployed at https://blog.z3bra.org by a git post-receive hook whenever I push to master, using make install.

                1. 2

                  I tried to go Makefile route once and there so many things to find out and decide (how do you do templates, indexes, tags) that it got unwieldy and I wrote my own with config syntax (and ideas) based on Makefile: gostatic.