Wiki source code of Template Properties
Last modified by Eleni Cojocariu on 2026/10/13 18:47
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | 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: | ||
| 2 | |||
| 3 | {{code language="none"}} | ||
| 4 | ##!source.syntax=xwiki/2.1 | ||
| 5 | {{info}} | ||
| 6 | Some info message | ||
| 7 | {{/info}} | ||
| 8 | {{/code}} | ||
| 9 | |||
| 10 | |=Property|=Values|=Default|=What it does | ||
| 11 | |##source.syntax##|a [[rendering input syntax>>doc:rendering:Main.WebHome||anchor="HSupportedSyntaxes"]]| |The parser used to interpret the result of the Velocity execution | ||
| 12 | |##raw.syntax##|a [[rendering input syntax>>doc:rendering:Main.WebHome||anchor="HSupportedSyntaxes"]]|##xhtml/1.0##|The syntax of the raw block the result is wrapped in. Ignored when ##source.syntax## is set | ||
| 13 | |##author##|the reference of an XWiki user| |The user the template is executed as. Filesystem and classloader templates only | ||
| 14 | |##privileged##|##true## or ##false##|##true##|Gives the filesystem or classloader template programming right, by executing it as ##xwiki:XWiki.superadmin## | ||
| 15 | |##cacheAllowed##|##true## or ##false##|##false##|Allows the result of the execution to be cached | ||
| 16 | |##asyncAllowed##|##true## or ##false##|##false##|Allows the template to be executed asynchronously | ||
| 17 | |##contextEntries##|a list of [[context entries>>doc:documentation.xs.dev.async-rendering.WebHome]]| |The entries of the execution context the template needs when it is executed asynchronously | ||
| 18 | |##unique##|##REQUEST##| |Executes the template at most once per request | ||
| 19 | |##require.<hint>##|depends on the requirement| |A condition that must be met before the template is executed | ||
| 20 | |||
| 21 | == Template requirements == | ||
| 22 | |||
| 23 | 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. | ||
| 24 | |||
| 25 | XWiki ships one requirement, ##action##, which matches the action of the current request against a Java regular expression: | ||
| 26 | |||
| 27 | {{code language="none"}} | ||
| 28 | ##!require.action=view|edit | ||
| 29 | {{/code}} |