Help:Semantic template format
The semantic template format allows editors to use a template to provide custom formatting for the results of an inline query.
The Template Parameter
When specifying format=template, an editor must specify the "template" parameter. (He can also use the "template" parameter when specifying "list" as the format.) That parameter names a template to be used to dictate the format of the line containing the query result. The effect of naming this template is the same as that of specifying any template having numbered parameters for inclusion in an article.
The Formatting Template
The proper form for a formatting template is as follows:
- All parameters must be numbered. Each parameter number receives a property value, in the order in which the editor specifies the properties in the query.
- Parser functions applied to parameters for computation or branching have unpredictable results.
- If the query results exceed any specified, default, or absolute maximum limit, the template does not attempt to format the linked "further results."
- If the query result would normally include an article title (that is to say, the value of a property of type page), then the template receives it as parameter 1 no matter where the article title appears in the property list. The template receives the rest of the property values for each line as parameters 2, 3, 4, and so on. If such an article title would not be a query result, then the template receives the property values as parameters 1, 2, 3, and so on, as you would normally expect.
Note: You can force parameter 1 to reserve itself for an article title, no matter what sort of results the query produces, by passing the parameter of mainlabel. This saves the effort of writing two forms of the same template.
This page is part of the CreationWiki Semantic MediaWiki Help series - prepared to assist editors in becoming productive members of the CreationWiki community. Browse the Table of Contents