adding meta headers to a livesite page

Posted: 26 June 2009 in layouts, LiveSite, SitePublisher, UI toolkits

if you look closely, the pages header in livesite only contain the title, keywords and description meta tags. If you want to add you own, such as <meta http-equiv=”content-type” content=”text/html; charset=utf-8″ />, then you have to modify the layouts a bit. Here is how it is done.

in /local/config/lib/content_center/livesite_customer_src/, you will find the toolkit for modifying the sitepublisher application. In there lies a configuration file for the layouts, in etc/conf/livesite_customer/pagetype-config.xml.

This defines the custom page types and layouts allowed in them. for example, to define a custom page type “acme custom html” the following xml would be required:

<page-types>
<page-type id=”acme_custom_html>
  <name>acme custom html</name>
 <output>
<doctype>
  <document-root>html</document-root>
  <doctype-public>-//W3C//DTD XHTML 1.0 Transitional//EN</doctype-public>
  </doctype>
  <method>xml</method>
  <content-type>text/html</content-type>
  <omit-xml-declaration>true</omit-xml-declaration>
  </output>
     <allowed-layouts>
          <layout refid=”acme-layout />
    </allowed-layouts>
  </page-type>
  </page-types>
 <layouts>
<layout id=”acme-layout”>
      <name>Acme layout</name>
      <stylesheet>com/interwoven/xsl/runtime/acme-layout.xsl</stylesheet>
      <class>com.interwoven.livesite.layout.impl.NoLayout</class>
    </layout>
</layouts>
 
This will add the page type, its id is unique (if you specify an id that already exists in /httpd/webapps/content_center/WEB-INF/classes/com/interwoven/livesite/pagetype-config.xml, you will be able to modify the default page types) and the users will know it as “acme custom html”.
 
This page allows 1 layout (think of a layout as an “composition” of your components on the page) named “acme-layout”. This layout is actually an xsl file on the classpath of the web application and therefore resides in web/WEB-INF/classes/com/interwoven/xsl/runtime/ under the name acme-layout.xsl. The class is used to calculate and make sense of the components positions to process them on the page, if need be.
All you need to do to add the meta tag in the header is to modify the xsl file with the <meta http-equiv=”content-type” content=”text/html; charset=utf-8″ /> content.
 
After you have modified the stylesheet to your liking, the livesite toolkit must be built. I’ve explained it here.
 
There is however a little omission by the build script that does not copy the xsl to all the appropriate places. As you know, the toolkit files are normally copied and merged with the existing equivalent files in the web application. So if you edit an xsl file in … it is copied to the the relevant folder httpd/webapps/content_center/WEB-INF/classes/com/interwoven/xsl/runtime/. This step seems to have been omitted by the script and needs to be also done for the iw-preview web application.
 
cp local/config/lib/content_center/livesite_customer_src/web/WEB-INF/classes/com/interwoven/xsl/runtime/*.xsl httpd/webapps/content_center/WEB-INF/classes/com/interwoven/xsl/runtime/ 
 

cp local/config/lib/content_center/livesite_customer_src/web/WEB-INF/classes/com/interwoven/xsl/runtime/*.xsl httpd/webapps/iw-preview/WEB-INF/classes/com/interwoven/xsl/runtime/ 
 
You may need to restart the user interface with iwreset -ui afterwards.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s