Template:Always substitute/doc
| This is a documentation subpage for Template:Always substitute. It may contain usage information, categories and other content that is not part of the original template page. |
__EXPECTED_UNCONNECTED_PAGE__
| This template uses Lua: |
| This template should never be substituted – use {{Always substitute}}. |
| This template is used on approximately 9,300 pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them. |
{{Always substitute}} produces the following notice:
This template should always be substituted – use {{subst:foo}}. — Source
(but the {{Always substitute}} template itself should never be substituted.)
Usage
{{Always substitute}}
{{Always substitute}} should be placed on the documentation subpage of any template that requires substitution rather than transclusion (not on the template's own page itself).
Parameters
All of the parameters for this template are optional. If no parameters are used when transcluding this template, it will default to displaying a notice stating that the referenced template "should always be substituted", and include the syntax that the reader should always use in order to substitute it onto a page. No additional statements are amended to the notice, and automatic categorization of the referenced template is allowed.
|yesnomaybe=- This parameter can be set to
never,not,can,may, oralways.- Setting it to
neverornotwill display a notice stating that the referenced template "should never be substituted" or "should not be substituted", respectively – and display the template syntax that the reader should always use in order to transclude it onto a page. - Setting it to
canormaywill display a notice stating that the referenced template "can be substituted" or "may be substituted", respectively – and display the template syntax that the reader can use in order to substitute it onto a page if they so choose. - Setting it to
alwayswill display a notice stating that the referenced template "should always be substituted" – and display the template syntax that the reader should always use in order to substitute it onto a page.
- Setting it to
- If this parameter is not used, or if it is set to a value not listed above, the template defaults to using
always. |auto=yes- Set this parameter to
yesif a Wikipedia bot automatically searches for accidental transclusions of the referenced template and fixes them to be substitutions, unless the|demo=yesparameter is set.- When set to
yes, the notice will include a statement with this information to the reader, as well as place the template that the notice refers to in Category:Wikipedia templates to be automatically substituted; see User:AnomieBOT/docs/TemplateSubster for more information. - This parameter is ignored by the template if
|yesnomaybe=is set to a value other thanalways, since this would cause it to show conflicting information to the reader that makes no sense.
- When set to
- If this parameter is not used, or if it is set to anything other than
yes,[1] the template defaults to usingno. |alt=- Set this parameter to the page title or location of an alternate template that the reader should use for transclusion instead of the template that the notice refers to (e.g.
|alt=Template:Exampleor|alt=Example).- Enter the page title or location using plain text. Do not include quotations, square brackets, or braces.
- When set to a page title or location, the notice will include a statement instructing the reader to use the alternate template for transclusions, and provide the appropriate template syntax for the reader to use.
- If the location entered for the alternate template includes "Template:" or "TM:" at the beginning of the text, it is automatically dropped from being displayed in the resulting template syntax.
- This parameter is ignored by the template if
|yesnomaybe=is set to a value other thanalways, since this would cause it to show conflicting information to the reader that makes no sense.
- If this parameter is not used, or if it is set to no value or to only whitespace characters, the template will default to not displaying the additional information to the reader.
|nocat=true- Set this parameter to
truein order to suppress automatic categorization of the template that it applies to.
- If this parameter is not used, or if it is set to anything other than
yes,[1] the template defaults to allowing automatic categorization.
Categorization
Pages that include {{Always substitute}} are added to Category:Wikipedia substituted templates.
Templates that substitute a template name string onto the target page in a comment (see hidden text) are added to Category:Templates with matching hidden id if and only if the substituted template name string matches the title of the template. For example: Template:Uw-coi contains the comment <!-- Template:Uw-coi -->. Since the substituted template name string within the comment matches the title of the Template, {{Uw-coi}} is a member of the category.
Notes
- ↑ 1.0 1.1 This template uses {{yesno-no}} to sanitize and parse the input so that the result is either
yesorno. As a result, setting this parameter to any input that is construed to be affirmative will also returnyes. See the template documentation for more information.
See also
- Wikipedia:Substitution – An introductory guide explaining substitution, how it differs from transclusion, and its benefits, drawbacks, and appropriate uses.
- Help:Substitution – A more detailed technical guide covering the MediaWiki substitution process, including advanced concepts such as the safesubst: modifier and recursive substitution.
See also
- {{require substitution}} – Prints an error unless substituted.
- {{ifsubst}} – if-then-else metatemplate that checks if a template is currently being substituted or transcluded.
- {{always substitute}} – For the doc of the above templates; prints a message asking for it be substituted.
- {{frequently substituted}} – Notice displayed in the documentation of substitution templates notifying the user that the template is widely used.
- {{never substitute}} – The reverse of {{always substitute}}. For the doc of templates which should not be substituted; prints a message asking for it not to be substituted.
- {{can be substituted}} – For the doc of templates whose substitution is optional.
- {{may be substituted}} – Same as the template above, but with the adverb may being used in the notice (instead of can).
- {{substitution}} – Allows free-fill description of whether the template should be substituted and under what conditions.
- {{issubst}} – Returns "yes" if substituted.
- {{error:must be substituted}} – Error message that can be used to warn the user
- {{HTML comment}} – To sign substitutions with comments that contain wikitext expansions.
- Module:Unsubst – Prevents substitution.
- Module:Unsubst-infobox – Prevents substitution for infoboxes, cleans up parameters.