Thursday, December 11, 2008

Magnolia 4.0: Supersonic Templating

I am happy to tell you that we just hit our 5th anniversary, and times at Magnolia are truly exciting. We have had a phenomenal year 2008, and we have every reason to believe that 2009 will be even more successful for us – not despite, but because of the economic downturn.

Right now, everyone is trying to cut costs, and Open-Source has an excellent value proposition. Magnolia has reached a level of maturity that is probably well beyond many of our future client's existing infrastructure. Magnolia's list of clients is extensive and leaves no doubt that Magnolia can be used in many different and demanding settings. Any way you look at it, Magnolia could not be in a better position. I have written about many factors coming together in favor of Open-Source business in general and Magnolia in particular in my blog entry titled "The Perfect Storm".

So at Magnolia, we are happy, but not complacent. We like what we do, and we work hard to improve Magnolia. Our recent work has been on two fronts - the first one is Magnolia On Air, which we have launched to great acclaim at Gilbane last week. We will talk about Magnolia On Air at length in the coming weeks.

The other front is Magnolia 4.0, in which we introduce what I like to call "Supersonic Templating" – because you can create custom, feature-rich, and pixel-perfect websites faster than you can fly from Paris to New York.

A short intermission about templates in Magnolia

Templates are used to generate output from Magnolia-managed content. Magnolia allows you to tie together an interface to manage data with a publication mechanism. A template provides the smarts to publish anything. Typically, publication is to the web as HTML, but templates can also be used to publish to other channels and other formats – PDF or RSS are two other common formats that come to mind in the context of web content management.

So while templates typically define the look & feel of a web-site, they also provide functionality. For instance, a template can be used to pull data from a third system (e.g. the "content" stored in Magnolia could be the connection and query information to an external database. The template would then use that information to query the database and render the output).

As you can see, templating is quite fundamental to Magnolia. Hence, it only makes sense to further improve the way you define templates and to provide examples of what can be done with Magnolia.


So what is Supersonic Templating?

First and foremost we have added fully-fledged Freemarker support to write templates. Freemarker is a templating language that provides many benefits over JSP (which we'll always and fully support). For instance, it has no dependency on the servlet API. This allows as to do many things we could not (or not easily) do with JSP's. For a start, Freemarker allows us to store templates in the repository. This handily allows us to put templates under version and access control, activate them and use workflow on templates.

The fact that Freemarker doesn't depend on Java means that you can write templates without knowing any Java at all. Freemarker simplifies the templates considerably. Jan has shown a typical example where the new Freemarker template is one-third of the size of our previous JSP template. It makes it easy to distinguish HTML markup from Freemarker code. The new Freemarker support will make it extremely easy for newcomers to get started with Magnolia and allow veterans to reduce their maintenance effort significantly.

There are many other benefits templating in Freemarker brings to Magnolia, which is why we believe it will be the templating language of choice for many new Magnolia sites.

Introducing the Standard Templating Kit

In addition, Magnolia 4.0 introduces a "Standard Templating Kit" (STK). Unlike our previously shipped "Sample Module", this is a complete, out-of-the-box website that can and should be used in production. It provides "templating best practice" and an extensive set of ready-made functionality that can easily be extended without changing the STK templates themselves. This is achieved through a new concept of configurable templates.

The STK renders accessible and 100% CSS-driven HTML. The STK templates and other resources (CSS, JavaScript) are stored in the repository. To allow access to these resources for Magnolia newcomers, we have added a module called "In-Place templating" which makes the Freemarker templates available through a simple web interface. This allows anybody to quickly see how things are done and perform simple changes on the templates themselves right in the browser.

Even better, we are working on providing WebDAV access to the template repository (probably in 4.1), which allows you to simply map a drive to the Magnolia template repository and use standard client html editors to edit the templates and the css. In other words, it gets very very sweet.

We are fully aware that in complex integration environments, templates will be part of a custom module, under SVN version control, built using maven or other build tools and deployed using the Magnolia packager module. But I believe that these new, easy-access templating mechanisms will bring many new users to the Magnolia platform and increase Magnolia's visibility in the CMS space.

New form module

Magnolia 4.0 also provides a new form module that adds new form fields, validation and form processors (e.g. to store the form data in a database). Form fields now have assignable keys that can be used to retrieve values, for instance to send customized confirmation mails using the new Mail module.

New mail module

The new Mail module allows you to send any Magnolia page as inline-HTML and to use Freemarker in mail templates. This makes it very easy to provide news-letter-style functionality.

Other goodies

Along the way we have added other goodies – we make various objects available to templating in JSP and Freemarker. This includes the current content, a model, paragraph and template definition object. Configurable paragraphs allow you to hide complexity that you previously added to user-facing content-editing dialogs. In other words, Magnolia will be even more user friendly because anything that doen't have to be in a user-dialog can be put somewhere else.


We also introduce the explicit notion of a "Site". You can configure multiple sites and assign a configuration to a content tree. Not only does this significantly improve support for multi-site installations, it also makes it simple to switch the layout of a site with the click of a button.

Final words

As you can see, Magnolia 4.0 will have a lot to offer. Most of the above features have already been implemented in the first preview version, available for download here.

Standard preview disclaimer: the preview is buggy and things *will* change or might not make it into the final product at all.

Before we release 4.0 at the end of January 2009, we will add more templates and define the final packaging. Later in 2009 we plan to provide more support for Web 2.0 / community functionality, add the WebDAV support mentioned above and start implementing GenUIne, the new Magnolia 5.0 architecture. As you can see, we will be busy.