Solprovider Lenya Kongregate Registration for Free Flash Games and Chat with solprovider

Displaying a Map of a Publication including the Document Descriptions

This article creates a page displaying every page on the site, including pages marked "not visible". It includes the Document descriptions. It does not mark the current document in any way. The instructions create a new Page as the "Sitemap", or it can be integrated into your current layout.

While this follows the Lenya paradigm, performance could be improved. On the bad side, the map is created for every page, regardless of whether it is needed. Performance would be better if the Usecase pipeline copied the lenyabody pipeline and replaced every "{4}" with "map". On the good side, any customization of the main pipeline is obeyed when using the integrated version.

NOTES

1. The term "sitemap" has special meaning for Cocoon, which I completely disregarded for this module.

2. While {pub} means your publication directory, braces in code are meant to kept. XMAP and XSL files use braces around variables, such as {page-envelope:publication-id} and {$url}, and CSS uses braces around each section.

Instructions

1. Download sitemap.zip. Unzip in your publication's directory (with publication-sitemap.xmap).
RESULT: "usecase-sitemap.xmap" should be in the publication directory, and 7 files including this "readme.txt" should be in the new "sitemap" directory.

2. FILE: {pub}/sitemap/sitemap.xmap
Change the line (near the end):
<map:parameter name="website" value="http://example.com"/>
to the prefix needed for your website. There are other options to control the columns, links, and indenting that you will want to change later.

3. To see the sitemap as HTML, browse to your publication and add the following to the URL:
?lenya.usecase=sitemap&html=1

4. Integration with your Publication's Look and Feel

4.1 Cache Issues
See "Disabling Caching for Dynamic Webpages"

4.2. CSS Integration
Add the CSS to your publication's CSS
COPY FROM FILE: {pub}/sitemap/sitemap.css
ADD TO FILE: {pub}/resources/shared/css/page.css

4.3 Publication Integration
FILE: {pub}/publication-sitemap.xmap
CHANGE:
<map:match pattern="lenya-document-*/*/*/**.xml">
<map:mount check-reload="true" reload-method="synchron" src="doctypes.xmap" uri-prefix="lenya-document-"/>
</map:match>


ADD 3 LINES:
<map:match pattern="lenya-document-*/*/*/**.xml">

<map:match type="step" pattern="sitemap">
<map:mount check-reload="true" reload-method="synchron" src="usecase-sitemap.xmap" uri-prefix="lenya-document-"/>
</map:match>

<map:mount check-reload="true" reload-method="synchron" src="doctypes.xmap" uri-prefix="lenya-document-"/>
</map:match>


4.4 Allow Access
Let visitors access it:
FILE: {pub}/xslt/page2xhtml.xsl
Add a link for:
<a href="?lenya.step=sitemap">Sitemap</a>

4.5 Linking from Hompage
If you add a link to your homepage, you should add a valid page before the "?lenya.step=sitemap". "/index.html?lenya.step=sitemap" will place the sitemap as the body of the homepage, which will rarely look good. An alternative is to force the doctype to "xhtml":

FILE: {pub}/publication-sitemap.xmap
CHANGE THIS LINE:
<map:generate src="cocoon:/lenyabody-view/{page-envelope:publication-id}/{page-envelope:area}/{page-envelope:document-type}{page-envelope:document-url}"/>

TO:
<map:select type="parameter">
<map:parameter name="parameter-selector-test" value="{request-param:lenya.step}"/>
<map:when test="sitemap">
<map:generate src="cocoon:/lenyabody-view/{page-envelope:publication-id}/{page-envelope:area}/xhtml{page-envelope:document-url}"/>
</map:when>
<map:otherwise>
<map:generate src="cocoon:/lenyabody-view/{page-envelope:publication-id}/{page-envelope:area}/{page-envelope:document-type}{page-envelope:document-url}"/>
</map:otherwise>
</map:select>


<< Website MapLink to Parent >>

Contact Solprovider
Paul Ercolino