I prefer static websites to a CMS for simple product websites because:
- Static websites are fast.
- I have more low-level control over the HTML/CSS.
- I don’t have to worry about the very-real threat of a CMS being hacked.
Obviously writing every page separately in raw HTML/CSS would go against one of the cardinal rules of development, Don’t Repeat Yourself. But you can avoid this using a static website generator such as Hammer for Mac.
Hammer uses a simple syntax embedded in HTML comments to ‘compile’ a website from source files. I have now used Hammer to create several static HTML/CSS websites, including my perfecttableplan.com and hyperplan.com websites.
I like the simple syntax of Hammer. For example:
I can put the HTML for a page header in an _header.html file and then each page just needs to start with:
<!-- @include _header.html -->
I can define and use variables:
<!-- $current_year 2016 -->
<p>Copyright <!-- $current_year -->.</p>
And I can let Hammer work out relative paths:
<img src="@path image.png" />
If Hammer can’t make sense of a source file (e.g. it can’t find the image file), it generates a compilation error.
Because everything is text based I can easily manage all the source in a version control system. Also, if I have to move away from Hammer, it should be relatively straightforward to change the syntax to another static generator (or even write a replacement for Hammer!).
Overall I like Hammer. But it does have a number of shortcomings:
1. The user interface is very limited. Hammer shows you a list of source files and you can click on a source file to see the compiled version or edit the source. But the source files are listed in the order they were edited and you can’t filter or sort the list. This seems such a simple and basic feature, that I can’t understand why the developers have omitted it.
2. Hammer takes a dumb, brute force approach to compilation. If you change any file in a source folder, it recompiles *everything*, without checking if other source files include that file. This is a pain if you have 100+ source files. Surely it wouldn’t be that hard to work out which files depend on which and only recompile the files that need recompiling?
3. You can’t nest variables. For example you can’t do this:
<!-- $current_year 2016 -->
<!-- $copyright_message Copyright <!-- $current_year --> -->
This might sound minor. But it limits the expressiveness of variables significantly.
4. The vendor doesn’t do email support. If you want to communicate with them you have to use Slack or Twitter. I am old fashioned, I like email.
5. It only runs on Mac OS X (the clue is in the name).
At one point Hammer looked like abandonware, but owner riothq.com sold it to beach.io and active development has resumed.
Currently Hammer is priced at £15.39 (and presumably some round number of US dollars). That seems way too cheap. I wish they would price it a bit higher and fix some of the issues above.
** Update Jan-2022 **
Hammer4mac doesn’t run on recent versions of macOS and seems to have been quietly abandoned by the developer for some time.