Is ther any CMS/blog/... type of thing that would create flat files, but keep all the content also in DB?
That way search and comments (and especially moderation for comments) would be easier to handle, but still it would be easy on the server.
For my own site I created something like this, https://github.com/Harri/Spage , but instead of DB, I used another set of flat files (serialized arrays containing the page content + some meta data) for management purposes.
There is also a WordPress plugin for generating static pages to upload later, but it's got a lot of gotchas and doesn't seem to have been updated recently. I'm using on my site.
Usually that can be achieved with a cache like Varnish. One of the biggest benefits of static site generators is that the only software you need on your server is a web server. As soon as you want to start adding things like search and comments, you lose that benefit.
You can use third party tools for both search (e.g. google site search) and comments (e.g. discus). Of course, if you want to customize things further with user-supplied content, at some point you'll need a dynamic backend.
It renders to static files by default (as well as compiling+compressing assets etc) and you can define any number of separate outputs in multiple formats (e.g. HTML, JSON, Javascript, XML, RSS etc) which will also be rendered at the same time.
Plus a whole world of other features, some I consider to be relatively revolutionary. </IMHO>
It works well but lacks, (really, really seriously) lacks, documentation.
I am currently building a static-file blogging system based on Prismic.io and Middleman. It's going pretty well.
The hardest part is that we are going to have a build server that rebuilds the stale parts of the site every hour or so - I don't think that's been done with Middleman before, so we're building that from scratch.
Caching has killed the need for SSG's for the most part. You can cache Drupal or Wordpress or pretty much anything with either plugins/modules or via a proxy like Varnish. These things work, generally, by copying the dynamic page and serving up a static page until they detect the page has changed or the user is requesting dynamic functionality (trying to post a comment, log in, etc).
I interpret the groundswell interest in the SSG a testament the CMS does not address all the needs in the content publication pipeline. Some organizations have a focus on content creators. Others on developers. In general, the hacker mindset has an allergy towards ecosystems that remove control. The SSG is about providing a framework for the developer to assert control and regaining flexibility to deliver content independent of coding to a "system".
The CMS is a crutch. It has its place in certain organizations. But it is overkill for many use cases.
In truth, however, we shouldn't be pitting the SSG against the CMS. I believe the next leap of content creation is a mixture of both SSG and classical CMS. Check out the following links:
Moveable Type was the first blog system I used, over 12 years ago. Oh the memories... my first exposure to Perl and setting up sites on a shared host. Slacking off in university labs to tweak the theme files/write posts/work out why site rebuilds were taking a stupidly long amount of time... fun times :)
That way search and comments (and especially moderation for comments) would be easier to handle, but still it would be easy on the server.
For my own site I created something like this, https://github.com/Harri/Spage , but instead of DB, I used another set of flat files (serialized arrays containing the page content + some meta data) for management purposes.