CMS Blog
Livesite category
Custom Page Layouts with LiveSite
LiveSite and Sitepublisher 3.1 have 2 interesting features that greatly enhance the powers of it. Let's have a close look at these.
Custom Page Types
First feature to mention is the 'Custom Page Types' (dubbed 'Doctype Support' in the manual, such a stupid name because it clashes with the well-known html-doctype. Using this mechanism one can define a xsl-stylesheet to use for the master page-html. This is important because I believe that the html that the default page-xsl produces is not very good. It is not accessible, not standard-compliant, fuzzy code is inserted and it uses a css-stylesheet which I don't like. In fact, I think code like this should always be custom-created.
Adding your own custom page type is very easy. Add something like below to livesite_customer_src/etc/conf/livesite_customer/pagetype-config.xml and rebuild the livesite-toolkit:
<page-types>
<page-type id="yourid" default="false">
<name>Any name</name>
<output>
<doctype/>
<method>html</method>
<content-type>text/html</content-type>
<omit-xml-declaration>true</omit-xml-declaration>
</output>
<allowed-layouts>
<layout refid="yourlayout"/>
</allowed-layouts>
</page-type>
</page-types>
<layouts>
<layout id="yourlayout">
<name>Your Layout</name>
<stylesheet>nl/contentdokter/xsl/runtime/yourstyle.xsl</stylesheet>
<class>com.interwoven.livesite.layout.impl.DivLayout</class>
</layout>
</layouts>
Now all you need to do is create your own xsl-stylesheet (under livesite_customer_src/etc/classes/nl/contentdokter/xsl/runtime/yourstyle.xsl). Two short tips on this:
1. use one of the xsl-files under httpdwebappscontent_centerWEB-INFclassescominterwovenxslruntime as a reference example
2. if your want to know how the source xml looks use this xsl-template:
<xsl:template match="/">
<xsl:copy-of select="."/>
</xsl:template>
Note that you could even, if you really have the courage, to write your own Layout-class in java. That is, however, not easy and I don't really see a good use for it.
Custom Fixed Layouts
The second feature to mention is the 'Custom Fixed Layouts'. Using this, you stop using the original free-flow layout of SitePublisher and instead divide your page into fixed areas in which your end-users can drop the components. A crucial feature, really, because I don't think I will ever meet a content-editor that can be bothered with placing a component on a pixel-exact detail. Too time-consuming and error-prone.
If you want to try it out yourself, follow the chapter on this in the manual but, important, the given example has 1 or 2 annoying errors that will break it!
A perfect world
Now, in a perfect world one would be able to combine these two features:
1. create a fixed layout matching your sites styleguide
2. create a custom page-stylesheet with clean html and all custom css/js included
Well, that will work but it won't! So yes, you can overwrite the default 'fixed-layout' with your own, and thus define which page-xsl to use. But you can NOT create a second (or third) layout-entry in pagetype-config for a fixed layout.
Thus is due to the fact that the (internal) java-code does a string-match in the layout-id for 'fixed-layout'. It would have been so much better would they have added a boolean attribute to the layout-element like 'is-fixed-layout'. But they haven't.
Typical. :-(
Livesite, additional documentation and example code
To kick off the new year here is Tip #1 on Livesite. Here is come additional documentation and source code that can help you tackle Livesite:
- The livesite java api-docs are hidden from plain view in a zip file under [iw-home]/install/livesite/docs. Not the most obvious place to look and further, not mentioned anywhere in the dev-manual.
- The java source of the pre-installed livesite-components can be found here (thank you Karel for pointing this out to me) /iwmnt/iwadmin/main/spars/STAGING/foundation/toolkit_src/ls_runtime_src. They are a good source for example code if you need to write your own java-extension for a component.
- The branch /default/main/component-guide contains a demo-website that shows all pre-installed live-components. This can come in handy if you are looking for more example code.
- And if you still haven't got enough you could install a java-decompiler (f.i java.decompiler.free.fr works very well for me) and decompile the livesite-runtime.jar located under [iw-home]/httpd/webapps/content_center/WEB-INF/lib. This will be of use in one of my next tips.
Happy newyear!
Not a fan of Livesite
I have never been a big fan of Livesite. Though the basic idea of combining open standards like Java en Xsl with a good looking GUI to render your content is charming, the Interwoven implementation of this idea has many issues. Well, let me call them "items to improve":
- the manual for developers is unreadable and almost useless;
- the installation and upgrade process is unnecessary complex. And apart from that, it messes up your existing installation with unwanted templates and workflows;
- the resulting (front-end) html is very messy and far from w3c-compliant or wai-accessible;
- all custom-configuration like components, layouts, etc. have a server-global-scope. It is impossible to limit the use of a specific component/layout to 1 branch only. Yes, your intranet news-component can be placed on a public-facing webpage!
- It is almost impossible to enforce a corporate webstyle. Editors are free to chose any available page-template for your public homepage.
- the preview, workflow & deploy mechanism does not follow the teamsite standards and good-practices. F.i. preview is not routed via the (flexible) iwproxy and uses the built-in tomcat. This has the side-effect that in order to install new java-code your must restart the servlet resulting in Teamsite downtime for other developers.
- an url-management-mechanism is missing. Search-engine-optimised-urls are out of your league.
The good news is that in the coming weeks I plan to post some tips on using and customising Livesite to your needs. I hope this will make your life with Livesite a little easier. Stay tuned.



