Finally found a way to deploy a Plone site statically
One of our clients came to us with a very specific requirement: we want to use Plone and we are not going to expose Plone, we need you to convert it to a static site.
Clients requirements didn't allow to expose Plone in production, as they wanted to serve everything in static to have the fastest possible user experience, so we started to analyze our options.
The first option was to run a wget command to get the static site. That was the easiest and fastest way to get our goal, and we were confident that it would work but our hands were tied to it and we wanted some more control over the statification process.
After some search, we found stxnext.staticdeployment. A product made by a polish company that fit exactly our needs: a Plone product to convert a dynamic Plone site into a static one. The product had a lot of features, such a content-type filter to decide which content-types to deploy statically. Or custom deployment steps to run after the deployment was made to fix some issues or made last-minute adjustments. It looked perfect, but... it had just one drawback: it did not support dexterity content-types and we were using them. We started to work on it, and we managed to adapt the product soon to be dexterity-compatible.
We also made some other changes to have a predictable way of getting the static site because the client wanted to deploy the static site several times a day, so we needed some other changes: execute extra custom deployment steps in a given order, fix the produced HTML files, have proper logging of all deployment steps... All our changes are in this pull-request.
Last week, a new release of the product was made and now you can install it directly using buildout in your Plone site, and have a full Plone site converted to static HTML files in a couple of minutes.
Of course the statification process makes that you lose all dynamic features of Plone: you cannot edit the live site, you cannot use Plone's search features, and you cannot use fancy search products like eea.facetednavigation (unless you program even fancier deployment steps), but it works for a plain Plone site with extra content-types and custom theme. You don't have to do anything strange: add the product in your buildout, check the configuration file, and hit "Deploy" in Plone Control Panel.
Yes, it looks like the Big Green Button imagined by Martin Aspeli in his famous "Pete and Andy try Plone 4" blog post.
You may be interested in these other articles
JakiZU! promoting food sustainability
Oct 28, 2024