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
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.
<site> <config> <input type="TextLine" name="company"> <label>Company</label> <occurrences minimum="1" maximum="1"/> </input> <input type="TextArea" name="description"> <label>Description</label> <occurrences minimum="1" maximum="1"/> </input> </config> </site>
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
<filters> element can be used for adding Response Filters.
Controller Mappings can also be configured in a site descriptor with a