Template Properties

Last modified by Eleni Cojocariu on 2026/10/13 18:47

Reference

A template declares its properties on the leading lines of its content, one per line, in the form shown below. The engine reads them and removes them from the content, so they never reach the parser:

##!source.syntax=xwiki/2.1
{{info}}
Some info message
{{/info}}
PropertyValuesDefaultWhat it does
source.syntaxa rendering input syntax The parser used to interpret the result of the Velocity execution
raw.syntaxa rendering input syntaxxhtml/1.0The syntax of the raw block the result is wrapped in. Ignored when source.syntax is set
authorthe reference of an XWiki user The user the template is executed as. Filesystem and classloader templates only
privilegedtrue or falsetrueGives the filesystem or classloader template programming right, by executing it as xwiki:XWiki.superadmin
cacheAllowedtrue or falsefalseAllows the result of the execution to be cached
asyncAllowedtrue or falsefalseAllows the template to be executed asynchronously
contextEntriesa list of context entries The entries of the execution context the template needs when it is executed asynchronously
uniqueREQUEST Executes the template at most once per request
require.<hint>depends on the requirement A condition that must be met before the template is executed

Template requirements

The part of a require. property after the dot is the hint of a component implementing org.xwiki.template.TemplateRequirement, and its value is whatever that component expects. A hint matching no component is ignored; a requirement that is not met stops the execution, and the template reports the failure instead of running.

XWiki ships one requirement, action, which matches the action of the current request against a Java regular expression:

##!require.action=view|edit

FAQ

What happens to a name that is not in the table?

It is kept as an untyped property, readable through TemplateContent.getProperty, and nothing in the engine acts on it.

Does a template have to declare any property?

No. A template with no leading property line is executed as Velocity and its result is wrapped in a raw block of xhtml/1.0.

Related

Get Connected