AnsweredAssumed Answered

How to serve an XML file

Question asked by leonardo.celati on Apr 22, 2014
Latest reply on Apr 22, 2014 by leonardo.celati
I am currently lost in providing to serve a sitemap.xml file from alfresco.

My purpose is to build an xml conform to sitemap.org schema, but all the tentavies result in having an htrml file on browser.

This is what I have done so far:

sitemap.xml (on alfresco share with mapping sitemap)

This is instead the list of files on the wcmqs webapp:


page/sitemap.xml

<?xml version="1.0" encoding="UTF-8"?>
<page>
   <id>sitemap</id>
   <description>specific page for sitemap</description>
   <template-instance>sitemap</template-instance>
   <authentication>none</authentication>
   <components>
        <component>
            <region-id>content</region-id>
            <url>/content/content-sitemap</url>
        </component>
   </components>
</page>


Then I have this template xml + ftl


template/sitemap.xml

<?xml version="1.0" encoding="UTF-8"?>
<template-instance>
        <title>sitemap</title>
        <description>Template for sitemap</description>
        <template-type>sitemap</template-type>
        <components></components>
</template-instance>



template/sitemap.ftl

<?xml version="1.0" encoding="UTF-8" ?>
<root>
   <@region id="content" scope="page"/>
</root>


Finally I have my webscripts which is supposed to iterate collection and display data


webscripts/sitemap.get.desc.xml

<webscript>
  <shortname>Simple sitemap</shortname>
  <description>Display simple sitemap</description>
  <url>/content/content-sitemap</url>
  <format default="xml"></any>
</webscript>



webscripts/sitemap.get.xml.ftl

<#if collection??>
   // iterate and build tags–>
   // ….
   // <—
</#if>



But everything results in an empty html file. Besides from investigating on why it is empty, but why the mimetype is set to html ?
What am I doing wrong ?

Outcomes