Jump to content

Wiktionary:TemplateData

From Wiktionary

TemplateData is a function in Wiktionary that Wiktionarians can use to add more information about a template. Such information includes descriptions about parameters in a template and how to use the template.

TemplateData is mainly used by VisualEditor, a tool that makes it easier for users to change pages on Wiktionary. VisualEditor has a tool that eases the process of adding and changing templates used on entry pages.

More information about TemplateData itself is available on the help page.

Without TemplateData

[change]
The template editor in VisualEditor provides no information about a template at all without TemplateData, and users will not know what the parameter should be for the template.

If TemplateData is not added to a template, VisualEditor will not know what parameters a template has, and will need the user to manually add them.

For most users, they do not know what the parameters to the template is. Although there may be very good documentation about how to use a template, not every user knows how to read and understand it, which results in them giving up on changing the page.

With TemplateData

[change]
With TemplateData, the template editor in VisualEditor now knows more information about a template (such as its parameters and descriptions for them). Those information is then given to the user so that the user knows how to use the template correctly.

When TemplateData is added to a template, a list of template parameters (and their description) is provided for the template. This helps users in letting them know what parameters the template accepts, and makes it easier for them to add templates to pages.

TemplateData also provides context for each parameter, and makes it much easier for users to change templates on entry pages. A short description is added at the top so that the user knows what the template parameter does and knows how to use it correctly.

Since it is much clearer for the user on how to use the template, it makes it a lot easier for the user to add and use templates on entry pages, and changing pages becomes a breeze.

Adding TemplateData

[change]

TemplateData is a JSON block that contains certain bits of information about the template. Anyone can help out in adding TemplateData to templates so that it makes it easier to use them in VisualEditor. This is a minimal example of how TemplateData is added to a template documentation page:

<templatedata>
{
	"description": "insert description here",
	"params": {
		"first parameter": {
			"label": "x",
			"description": "x",
			"type": "string",
			"default": "default value",
			"required": false
		}
	}
}
</templatedata>

TemplateData is added to either the template itself (inside the tags), or the /doc documentation page. The TemplateData is added in its own section after the main documentation of the template and just before the "See also" section of the documentation page. {{TemplateDataHeader}} is also added just before the TemplateData block itself so as to categorize the page to Category:Templates with TemplateData documentation.

We have provided more information about adding TemplateData on this page. Once you know more about adding TemplateData, there is also a gadget (which you can enable in your preferences) that makes it easier for you to change the TemplateData block. You can read more documentation about using the tool.

See also

[change]