Actually this is one of the core features of the Ruby CMS I've been working on for the last few years http://spontaneous.io
It's template engine supports two tag types: one that gets run during the publish stage & one that get's run at the request stage.
It can then take an intelligent approach to publishing by having a publish step that renders each page to a static file. It's then trivial to test for the existence of 'run at request' tags and position the generated template accordingly: pure static files get put where a reverse proxy (nginx by preference) can see them, anything with per-request tags gets put in a 'private' directory out of nginx's paths for rendering & delivery by some front-end server.
This has many advantages, including:
- static pages can be served directly by Nginx
- the public facing site runs in a separate process that consumes the generated templates
- the public app (if needed at all) has no admin-centric code so has a smaller (& separate) attack surface
- the publish step can be seen as a form of code generation so you could, in theory, publish a dynamic PHP powered site from this Ruby CMS
I'm also gradually working towards abstracting the template 'filesystem', currently you can render to the disk, redis, memcache or any other key-value store supported by the Moneta gem[1].
For the developer it gives the power of static site generators but provides a simple & usable editing interface for content editors.
It's template engine supports two tag types: one that gets run during the publish stage & one that get's run at the request stage.
It can then take an intelligent approach to publishing by having a publish step that renders each page to a static file. It's then trivial to test for the existence of 'run at request' tags and position the generated template accordingly: pure static files get put where a reverse proxy (nginx by preference) can see them, anything with per-request tags gets put in a 'private' directory out of nginx's paths for rendering & delivery by some front-end server.
This has many advantages, including:
- static pages can be served directly by Nginx - the public facing site runs in a separate process that consumes the generated templates - the public app (if needed at all) has no admin-centric code so has a smaller (& separate) attack surface - the publish step can be seen as a form of code generation so you could, in theory, publish a dynamic PHP powered site from this Ruby CMS
I'm also gradually working towards abstracting the template 'filesystem', currently you can render to the disk, redis, memcache or any other key-value store supported by the Moneta gem[1].
For the developer it gives the power of static site generators but provides a simple & usable editing interface for content editors.
[1]: https://github.com/minad/moneta