Hacker News new | ask | show | jobs
by AnkhMorporkian 3888 days ago
You know what I've always wanted, but my searches have led me to believe that it (inexplicably) doesn't exist?

I want a simple site generator. I don't want markdown, I don't want a fancy templating engine. I want some simple templating system that takes in normal HTML and generates pages from simple templates I define. I want to shove in some arbitrary HTML and have it spit out a site using some base templates.

To the best of my knowledge, that doesn't exist. It would be perfect for someone like me who wants to keep a website updated, but doesn't always want to run PHP on the server for something as simple as that.

I implemented a shoddy version of it on my own, but it's far from ideal. I'm pretty astounded there's not a well thought out version of it out there, considering how useful it seems it would be.

8 comments

Have you tried Middleman (mentioned in the article)? I've used it for a few years and found it incredibly simple.

https://middlemanapp.com/

I built a very simple admin-interface with it,

input: https://github.com/lms-io/scormfu-admin/blob/master/source/i...

output: https://github.com/lms-io/scormfu-admin/blob/master/build/in...

That looks exactly like what I was envisioning. Thank you so much!
Jekyll and Middleman have already been mentioned but another is nanoc [http://nanoc.ws/] which I like because it is not so blog-centric. You can get a good overview of how it works relative to what you want just by reading the Rules doc page [http://nanoc.ws/docs/reference/rules/], but essentially it does nothing by default except dump your HTML input into the body of the default layout. I use it for moderately complex as well as dumb I-just-want-a-few-variables-to-stay-updated things, the only downside being multisecond compilation times with many pages.
Jekyll (and probably most other generators) works fine with HTML, you don't have to use markdown.
Can you clarify what you mean by "simple templates"?

It may not be along the lines of what you're hoping for (it may not be simple enough), but I've found Stasis[1] to be a powerful tool for static site generation.

You can write plain old HTML pages and/or fragments, with your desired level or genericity, and then run them through a set of transformations[2] to fill in content, set attributes (e.g. classes, styles, whatever), un/wrap elements, and so on.

[1] https://github.com/magnars/stasis

[2] https://github.com/cgrand/enlive

I wrote something that works like that, called templer:

https://github.com/skx/templer

In the past I wrote all my HTML pages by hand. Then I started just writing the "body"-area, and concatenating a header, footer, and the body together to generate output. After that I started to make more changes.

In the end it grew, as these things do, but at the core templer allows you to put "stuff" into a "layout", and generates the output. It might suit you, or it might not. But there are many similar tools out there.

This is exactly what Dreamweaver templates do. You define the template files with editable areas, then you create individual pages based on the template files. When you change a template, Dreamweaver regenerates all the page files to reflect the change. It's all done in HTML with no weird compilers or parsers needed. SFTP the files into your public webroot and you're done.

This was one of the original "static site generators". And it's still used today, for example by the Smithsonian for some of their museum sites.

A fancy templating engine can be a simple templating engine by just not using all the features.

Statsi Site Generation is one of those thing s where I think Not Invented Here is a legitimate point of view. Your exact use case is never going to match the exact use case of other people so you should roll your own rather than trying to customize an existing solution.

Plus writing a SSG is super fun, it's like the most 1960's thing you can do (Input Docs->Processing->Output Docs)

Dreamweaver?

People can hate on it all day, but that is exactly what it does. There is a reason it was such a huge tool 15 years ago.

Yep, Dreamweaver has an excellent template engine.