Jump to content

Template:Ifsubst

From mediawiki.org
Template documentation

Usage

[edit]

Meta template that returns the first parameter if evaluated during substitution, and the second parameter if evaluated during transclusion.
Note that this template must be used insafesubstmode to work properly:

{{ {{{|safesubst:}}}ifsubst| yes | no }}

The|demo=parameter can be used for testing the template. Set|demo=yesto always display theyestext,|demo=noto always display thenotext, or|demo={{{demo|}}}to pass through the value from the parent template.

TemplateData

[edit]

This is theTemplateDatadocumentation for this template used byVisualEditorand other tools.

Ifsubst

Meta-template that shows different results when substituted or transcluded.

Template parameters

ParameterDescriptionTypeStatus
Substituted1

The result when this template is substituted.

Contentsuggested
Transcluded2

The result when this template is not substituted.

Auto value
{{error:must be substituted|{{subst:#switch:{{subst:NAMESPACE}}|{{subst:ns:10}}=|{{subst:ns:0}}=:|#default={{subst:NAMESPACE}}:}}{{subst:PAGENAME}}}}
Contentsuggested
Demo?demo

Whether to show the substituted result regardless of whether the template was actually substituted. Set to “no” to always show the transcluded result.

Auto value
{{{demo|<noinclude>1</noinclude>}}}
Stringoptional
Editparameter translations