NOTE: This module is no longer of any use. An extension to the RequestModule has been implemented; You can now use {request:sitemapURIPrefix}

This is an input module that determines the absolute URI to the base of the sitemap. It can help you to make your Cocoon application relocatable. The problem with this was described by Gianugo

The SitemapURIModule takes care of the calculation mentioned in the quotation.

Thus, if you use {sitemap-uri:}, it will be substituted by /whatever/ or /whatever/the/user/wants/. You can append a relative URI within the sitemap, as in {sitemap-uri:you/like}, which gives /whatever/you/like.

The code for this input module is attached to this page (see 'attachments' under 'more actions').


This module does not work correctly if the sitemap-URI changes during the request. Such a change may occur because of a sitemap-redirection or a call to Flowscript. The cause for this problem is, that the SitemapURIModule computes the sitemap-base-URI by subtracting the sitemap-URI from the request-URI:

For example, suppose that you have a sitemap mounted at "/a/b/", and the request-URI is "/a/b/c/d", you get

If the pipeline redirects "c/d" to "e",

the sitemap-URI changes to "e". In this case, the base-sitemap-URI cannot be computed:

As far as I can see, this is not easily solved in the input module itself. However, the sitemap-base-URI is available internally in the Environment of the Request, through the getURIPrefix() method. This could be accessed through the RequestModule.

SitemapURIModule (last edited 2009-09-20 23:42:50 by localhost)