Added by Dennis Dam, last edited by Jasha Joachimsthal on Feb 17, 2009  (view change)

Labels:

preview preview Delete
Enter labels to add to this page:
Wait Image 
Looking for a label? Just start typing.
Hippo CMS Version:
v6.04.00
 Experience level:
Developer
 Developer goals:
 

Introduction

The CMS has had the preview functionality for quite some time. Up until version 6.04.00, only one preview url could be configured, which was used for previewing every document in the repository. In some situations, you might want to have more than one preview url. An example is a multi-site setup, where there multiple root folders in the repository, which contain content for separate websites (with different domains). This document explains how you can configure preview urls for categories of content.

Configure the locationmap

You need to provide a locationmap to the CMS, which will serve multiple purposes. One of those is mapping CMS folders to preview urls. Another one is mapping folders to type categories, which is discussed on this page. You have to set two build properties to plug the locationmap into the CMS:

CMS build propery description default
cms.locationmap.src The location of the locationmap, e.g. cocoon://extensions/locationmap.xml context://locationmap.xml
cms.locationmap.eventCacheable Set this to true if you generate the locationmap using sources from the repository false

Next, create the locationmap at the correct location, and provide a mapping of folders to preview urls in the locationmap. An example locationmap:

<locationmap xmlns="http://apache.org/cocoon/locationmap/1.0">

  <components>
    <matchers default="locationmap">
      <matcher
        name="locationmap"
        src="nl.hippo.forrest.locationmap.WildcardLocationMapHintMatcher"/>
    </matchers>
  </components>
  <locator> 

    <match pattern="preview-url:**">
        
      <match pattern="*:/content/subsite1/**.xml">
        <location src="http://subsite1.yourCompany.com/{2}.html"/>
      </match>

      <match pattern="*:/content/subsite2/**.xml">
        <location src="http://subsite2.yourCompany.com/{2}.html"/>
      </match>

      <!-- "catch all" matcher -->
      <match pattern="**">
        <location src="http://the-rest.yourcompany.com/preview/{1}"/>
      </match>

    </match>

  </locator>

</locationmap>

As you can see, the locationmap needs matches of the form preview-url:<document pattern>. The location element's src attribute will return the preview url associated with the matched document.