FamilySearch Wiki:Template documentation: Difference between revisions

m
fix template
m (fix template)
m (fix template)
Line 9: Line 9:
* The '''[[Help:Templates#Parameters|parameters]]''' of the template: whether they are numbered, named or optional, and if so, what the default values are and what effect they have. If a parameter can take only a limited set of values or is constrained in any way, for example, if it can only use "yes", "no", or a number, this should be clearly explained.
* The '''[[Help:Templates#Parameters|parameters]]''' of the template: whether they are numbered, named or optional, and if so, what the default values are and what effect they have. If a parameter can take only a limited set of values or is constrained in any way, for example, if it can only use "yes", "no", or a number, this should be clearly explained.
* '''Usage examples''': specify the exact wikitext that should be used and the result that it produces. The wikitext can be enclosed in a {{tag|code}} container, to make it clear and <code>easy to copy, like this</code>. If the template can be used in several different ways, with or without optional parameters, for example, provide a range of examples. A good way to do so is to transclude the template itself into the documentation a few times (i.e., use live examples), with different parameters each time and list the parameters used in each case. With [[Template:Xpd]] this can be done without putting the template call twice in the wikitext.
* '''Usage examples''': specify the exact wikitext that should be used and the result that it produces. The wikitext can be enclosed in a {{tag|code}} container, to make it clear and <code>easy to copy, like this</code>. If the template can be used in several different ways, with or without optional parameters, for example, provide a range of examples. A good way to do so is to transclude the template itself into the documentation a few times (i.e., use live examples), with different parameters each time and list the parameters used in each case. With [[Template:Xpd]] this can be done without putting the template call twice in the wikitext.
* '''Related templates''': if the template is one of a series of templates, include links to these – in particular, ensure that every template in the series is linked from each of the others, as this makes navigation easier. (A separate navigation template may be useful for this purpose, see: [[Template:Protection templates]]).
* '''Related templates''': if the template is one of a series of templates, include links to these – in particular, ensure that every template in the series is linked from each of the others, as this makes navigation easier. (A separate navigation template may be useful for this purpose, see: Template:Protection templates).
* '''[[FamilySearch Wiki:Categorization|Categories]]''' and '''[[FamilySearch Wiki:InterWikimedia links|InterWikimedia links]]''', where applicable. Like the documentation, these must be within a {{tag|noinclude}} container. Many template categories are available, see: [[:Category:FamilySearch Wiki templates]] to browse through them.
* '''[[FamilySearch Wiki:Categorization|Categories]]''' and '''[[FamilySearch Wiki:InterWikimedia links|InterWikimedia links]]''', where applicable. Like the documentation, these must be within a {{tag|noinclude}} container. Many template categories are available, see: [[:Category:FamilySearch Wiki templates]] to browse through them.


Template documentation is often placed in a [[FamilySearch Wiki:Subpages|subpage]] of the template itself, which is then [[FamilySearch Wiki:Transclusion|transcluded]] at the end of the template page. This separates the often complex template code from the documentation, making the documentation easier to edit. It also allows templates to be [[FamilySearch Wiki:Protection policy|protected]] where necessary, while allowing anyone to edit the documentation. This method is sometimes referred to as the "template doc page pattern".
Template documentation is often placed in a [[FamilySearch Wiki:Subpages|subpage]] of the template itself, which is then [[FamilySearch Wiki:Transclusion|transcluded]] at the end of the template page. This separates the often complex template code from the documentation, making the documentation easier to edit. It also allows templates to be FamilySearch Wiki:Protection policy protected where necessary, while allowing anyone to edit the documentation. This method is sometimes referred to as the "template doc page pattern".


Documentation of any sort on a template page should always be enclosed by a {{tag|noinclude}} container, so that it does not show up when the template is used on another page. Text on the template page itself adds to the amount of text that must be processed when displaying the template, which is [[FamilySearch Wiki:Template limits|limited]] for performance reasons. Placing the documentation in a subpage avoids this (MediaWiki developers have recommended it for this reason).
Documentation of any sort on a template page should always be enclosed by a {{tag|noinclude}} container, so that it does not show up when the template is used on another page. Text on the template page itself adds to the amount of text that must be processed when displaying the template, which is [[FamilySearch Wiki:Template limits|limited]] for performance reasons. Placing the documentation in a subpage avoids this (MediaWiki developers have recommended it for this reason).
42,316

edits