User:Banri/TemplateData: Difference between revisions

Created page with "When a template is used or edited in VisualEditor, VisualEditor tries to guess what parameters the template has. You can make this easier by adding "TemplateData" to templates..."
 
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 9: Line 9:
1. Go on the template '''documentation''' page (for consistency, don't add TemplateData to the template itself) and click '''Edit source'''
1. Go on the template '''documentation''' page (for consistency, don't add TemplateData to the template itself) and click '''Edit source'''


(Image goes here)
https://i.imgur.com/HQmUSin.png


2. Click '''Manage TemplateData'''
2. Click '''Manage TemplateData'''


(Image goes here)
https://i.imgur.com/nUzds3U.png


3. Set the language (should be '''English'''), add a description of the template, and then change the wikitext formatting.
3. Set the language (should be '''English'''), add a description of the template, and then change the wikitext formatting.
Line 39: Line 39:
|}
|}


(Image goes here)
https://i.imgur.com/47fEaDE.png


4. For each parameter an editor can give to a template, press the '''Add parameter''' button at the bottom, enter its name (e.g 'param1'). Click on it when its added to the list and fill out the information:
4. For each parameter an editor can give to a template, press the '''Add parameter''' button at the bottom, enter its name (e.g 'param1'). Click on it when its added to the list and fill out the information:
Line 70: Line 70:
|}
|}


(Image goes here)
https://i.imgur.com/v9aOkjO.png


5. When done with adding parameters, press '''Apply''' at the top right of the interface. The TemplateData will be added to your cursor position on the page between the <code><nowiki><TemplateData></nowiki></code> tags. Move this to somewhere more convenient if necessary.
5. When done with adding parameters, press '''Apply''' at the top right of the interface. The TemplateData will be added to your cursor position on the page between the <code><nowiki><TemplateData></nowiki></code> tags. Move this to somewhere more convenient if necessary.
Line 90: Line 90:
</pre>
</pre>


This is how a template with TemplateData displays in VisualEditor:
This is how a template with TemplateData displays in VisualEditor
 
(Image goes here)


===Further help===
===Further help===
* [https://en.wikipedia.org/wiki/Wikipedia:TemplateData/Tutorial Wikipedia's tutorial on TemplateData]
* [https://en.wikipedia.org/wiki/Wikipedia:TemplateData/Tutorial Wikipedia's tutorial on TemplateData]
* [https://www.mediawiki.org/wiki/Help:TemplateData MediaWiki help page for TemplateData]
* [https://www.mediawiki.org/wiki/Help:TemplateData MediaWiki help page for TemplateData]