Theme Rendering and Page Resources

The Trouble with Themes #

Today Rendering is ultimately completed by the Liferay portal. It goes through and aggregates all the renderings of each portal wrapping them up with theme and layout markup, in the end it spits out the whole thing. Voila! It works great. The problem is that today the Themes seem to have usurped a whole lot of power. They have a lot of responsibility, including rendering the markup prolog, head tags, and other non visible but functional body contents.

The dilema is that themes aren't really smart enough (and should not be) to know what's going on or more specifically what kinds of things belong in the head of the HTML focument. If you are going to be responsible to write the Head section of an HTML file you better be "In The Know" about all the needs of the contents on the page including what CSS, Script, Metatags etc each application and other rendering component (like portlets) requires (Themes, Layouts, Pages are also rendering components).

A portlet is a self contained application. It may come with css, javascripts, require certain meta information in the head (like RDF or a refresh etc.) The portlet itself is the only component that should have compile time awareness of this need. Today however, themes are the only place to put this functionality and as a result we overburden the themes and create a monsterous cohesion between our themes and portlets limiting the plugability of all parties involved

Page Resources#

A page resource or render resource is an abstraction for something needed at render time. Resource is supplied to the rendering component but where it [the resource] came from is not the business of the rendering component.

Some generic rendering resources might be Title description

Some HTML specific resources might be Styles Javascript Base URL Head Link tags Head Meta stags Document Type Top javascript Bottom javascript On Load Javascript

The Theme API #

In order to provide the context of page resources you may consider reading the following sections Liferay Public API

0 Attachments
11385 Views
Average (0 Votes)
The average rating is 0.0 stars out of 5.
Comments