Vladimir Sedach

Have Emacs - Will Hack

March 6, 2018

Using Make for generating static websites

Topic: Blog

In the past week, a couple of articles about Make showed up as submissions on Hacker News and managed to become controversial. It seems the suggestion that you can use Make for web projects is upsetting for a lot of people:

I mentioned previously that this website is generated using GNU Make. I think Make together with standard Unix utilities and version control is one of the best ways to generate static websites.

Here is the Makefile I use to generate this website, including the blog and the blog ATOM feed:


tidy is used for HTML validation and xmllint for ATOM feed validation.

Both the source and output files are versioned with git, so that unit testing consists of regenerating files and seeing whether git-status reports any changes.

Having the website versioned with git provides advantages that taken together cannot be matched with web-based blogging tools: you can work on the website on any of your machines, even while offline, using magit, the best change management and conflict merging tool I have come across as of the time of this writing. The website and its change history is automatically backed up wherever you have the repository checked out. You can use any tools or editors to do the work. Simply put, distributed version control systems are the ultimate CMS.

Another superior workflow this system enables is using email for blog comments. When using Blogger or other web-based blogging tools, your readers submit comments in a web form. This either forces your readers into solving annoying captchas, or results in your comment sections being filled with spam. Since you usually want to moderate comments anyway, you get an email notification about a pending comment, then log in to a web page, then click around to reject or approve the comments.

Receiving comments on blog posts via email is a superior system. Your blog readers can use their preferred email client without having to be subjected to the indignities of captchas. You skip the notification step - the comments go straight to your inbox (which you can read with your preferred email client, offline; blog post describing my offline email setup with Emacs forthcoming). You can choose to post the comment, or reply to the commenter directly. No need to go to a web page or even be online to post or reply, either. Your blog does not need its own spam filter because your email inbox already has a better one.