Site Descriptors

To indicate that an application provides “site capabilities” and allow it to be added to sites, a site descriptor must be placed into the application. Within your project, simply add a file called /src/main/resources/site/site.xml.

The site.xml file also makes use of the Schemas concept, so you may easily define custom forms for configuring the application when adding it to a site. These configurations are made in the <config> element.

    <input type="TextLine" name="company">
      <occurrences minimum="1" maximum="1"/>
    <input type="TextArea" name="description">
      <occurrences minimum="1" maximum="1"/>

All controllers within the app can access the configured values with the portal.getSiteConfig() function.

var portal = require('/lib/xp/portal');

// Find the site configuration for this app in current site.
var siteConfig = portal.getSiteConfig();


An app’s site.xml file may optionally contain other elements, placed outside the <config> node.

Use <x-data> element for adding X-data or <inline> element for adding Mixins Adding extra data this way will automatically add that data to the content in Content Studio.

Additionally, the <filters> element can be used for adding Response Filters.

Controller Mappings can also be configured in a site descriptor with a <mappings> element.