logoalt Hacker News

hnlmorgtoday at 7:29 PM1 replyview on HN

Forgive my ignorance here but if you want to write HTML then what do you gain from a static site generator?

Couldn’t you just ‘cat’ your templates together with a shell script?


Replies

bigbuppotoday at 8:37 PM

Starting with clean valid semantic HTML makes it a whole heck of a lot easier to preview in a web browser or editor with a preview feature and gives you quite a few editing options. Granted, there are now live markdown previews in some editors, so this is less of a concern than it was. However, you can easily toss in some CSS in there to make things a little nicer, while the typical markdown preview is going to look like Netscape 2.

As for the templates... those are also HTML. You're just replacing the relevant part of the template's DOM with what you pulled from the source document. Same goes for any boxes on the page you need to stuff with generated content. Your index pages and blog lists are generated from the metadata and other items pulled from the relevant parts of the source documents using the favored html processsing library of the week.