• Home
  • Random
  • Nearby
  • Log in
  • Settings
Donate Now If Wikipedia is useful to you, please give today.
  • About Wikipedia
  • Disclaimers
Wikipedia

Template:If preview/sandbox

  • Template
  • Talk
  • Language
  • Watch
  • Edit
< Template:If preview


This is the template sandbox page for Template:If preview (diff).
See also the companion subpage for test cases.
Template documentation[view] [edit] [history] [purge]
WarningThis template is used on approximately 63,000 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.
This template uses Lua:
  • Module:If preview (sandbox)

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

Usage

edit

{{If preview|value if being previewed|value if not being previewed}}

{{If preview|1=value if being previewed|2=value if not being previewed}}

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

Examples

edit

Preview this page to see the effect of previewing on the 'Example' column.

Code Example Value when previewed Value when saved
{{If preview|Yes|No}}
{{If preview|1=Yes|2=No}}
No
No
Yes No
{{If preview|Red}}
{{If preview|1=Red}}

Red
{{If preview||Blue}}
{{If preview|2=Blue}}
Blue
Blue
Blue

See also

edit
  • {{Preview warning}}
The above documentation is transcluded from Template:If preview/doc. (edit | history)
Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages.
Add categories to the /doc subpage. Subpages of this template.
Retrieved from "https://en.wikipedia.org/w/index.php?title=Template:If_preview/sandbox&oldid=1021431132"
Last edited on 4 May 2021, at 17:33

Languages

      This page is not available in other languages.

      Wikipedia
      • Wikimedia Foundation
      • Powered by MediaWiki
      • This page was last edited on 4 May 2021, at 17:33 (UTC).
      • Content is available under CC BY-SA 4.0 unless otherwise noted.
      • Privacy policy
      • About Wikipedia
      • Disclaimers
      • Contact Wikipedia
      • Code of Conduct
      • Developers
      • Statistics
      • Cookie statement
      • Terms of Use
      • Desktop