Changes

Jump to navigation Jump to search
no edit summary
{{Documentation subpage}}
{{Lua|Module:If preview}}

This is a template that helps other templates determine if they are being previewed or not, and do or display different things accordingly.

== Usage ==
<code><nowiki>{{If preview|value if being previewed|value if not being previewed}}</nowiki></code>

The first parameter is returned if the page is being previewed, otherwise the second parameter will be returned. Either parameter may be empty.

==Examples==
Preview this page to see the effect of previewing on the Example column.
{|class=wikitable
!Code
!Value when previewed
!Value when saved
!Example
|-
|<code><nowiki>{{If preview|Yes|No}}</nowiki></code>
|Yes
|No
|{{If preview|Yes|No}}
|-
|<code><nowiki>{{If preview|Red}}</nowiki></code>
|Red
|
|{{If preview|Red}}
|-
|<code><nowiki>{{If preview||Blue}}</nowiki></code>
|
|Blue
|{{If preview||Blue}}
|}

==See also==
*{{tl|Preview warning}}
<includeonly>{{sandbox other||
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:If-then-else templates]]
}}</includeonly>
Anonymous user

Navigation menu