Difference between revisions of "Template:Ifexist not redirect/doc"

From blackwiki
Jump to navigation Jump to search
imported>Alex 21
imported>MSGJ
(update)
Line 2: Line 2:
 
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
 
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
 
== Usage ==
 
== Usage ==
The '''<nowiki>{{</nowiki>Ifexist not redirect}}''' template returns true if an article exists ''and'' exists as an actual article, and returns false if the article either does not exist, exists as a redirect, or is empty, whereas {{#ifexist}} will return true if the article is a redirect or empty. Use the format <code><nowiki>{{Ifexist not redirect|article}}</nowiki></code>.
+
The '''<nowiki>{{</nowiki>Ifexist not redirect}}''' template can be used to identify a page which exists, is not blank, and is not a redirect; whereas {{#ifexist}} will only check whether the page exists.
 +
 
 +
Use the format <code><nowiki>{{Ifexist not redirect|page|return if true|return if false}}</nowiki></code>. The 2nd and 3rd parameters are used to define the output of the template if the condition is true or false, respectively. If not defined the default output is "yes" if true and empty if false.
  
 
==Examples==
 
==Examples==
 
''Existing article'' ([[List of Doctor Who serials]]):
 
''Existing article'' ([[List of Doctor Who serials]]):
* <code><nowiki>{{Ifexist not redirect|List of Doctor Who serials}}</nowiki></code>: {{Ifexist not redirect|List of Doctor Who serials}}
+
* <code><nowiki>{{Ifexist not redirect|List of Doctor Who serials|true|false}}</nowiki></code>: {{Ifexist not redirect|List of Doctor Who serials|true|false}}
* <code><nowiki>{{#ifexist:List of Doctor Who serials|yes}}</nowiki></code>: {{#ifexist:List of Doctor Who serials|yes}}
+
* <code><nowiki>{{#ifexist:List of Doctor Who serials|true|false}}</nowiki></code>: {{#ifexist:List of Doctor Who serials|true|false}}
  
 
''Redirect'' ([[List of Daredevil episodes]]):
 
''Redirect'' ([[List of Daredevil episodes]]):
* <code><nowiki>{{Ifexist not redirect|List of Daredevil episodes}}</nowiki></code>: {{Ifexist not redirect|List of Daredevil episodes}}
+
* <code><nowiki>{{Ifexist not redirect|List of Daredevil episodes|yes|no}}</nowiki></code>: {{Ifexist not redirect|List of Daredevil episodes|yes|no}}
* <code><nowiki>{{#ifexist:List of Daredevil episodes|yes}}</nowiki></code>: {{#ifexist:List of Daredevil episodes|yes}}
+
* <code><nowiki>{{#ifexist:List of Daredevil episodes|yes|no}}</nowiki></code>: {{#ifexist:List of Daredevil episodes|yes|no}}
  
 
''Empty article'' ([[Template:Ifexist not redirect/testpage]]):
 
''Empty article'' ([[Template:Ifexist not redirect/testpage]]):
Line 18: Line 20:
  
 
''Non-existant article'' ([[Green Arrow episodes]]):
 
''Non-existant article'' ([[Green Arrow episodes]]):
* <code><nowiki>{{Ifexist not redirect|Green Arrow episodes}}</nowiki></code>: {{Ifexist not redirect|Green Arrow episodes}}
+
* <code><nowiki>{{Ifexist not redirect|Green Arrow episodes|1|0}}</nowiki></code>: {{Ifexist not redirect|Green Arrow episodes|1|0}}
* <code><nowiki>{{#ifexist:Green Arrow episodes|yes}}</nowiki></code>: {{#ifexist:Green Arrow episodes|yes}}
+
* <code><nowiki>{{#ifexist:Green Arrow episodes|1|0}}</nowiki></code>: {{#ifexist:Green Arrow episodes|1|0}}
 
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
 
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
 
<!-- Categories below this line, please; interwikis at Wikidata -->
 
<!-- Categories below this line, please; interwikis at Wikidata -->
 
}}</includeonly>
 
}}</includeonly>

Revision as of 21:55, 14 March 2016

Usage

The {{Ifexist not redirect}} template can be used to identify a page which exists, is not blank, and is not a redirect; whereas {{#ifexist}} will only check whether the page exists.

Use the format {{Ifexist not redirect|page|return if true|return if false}}. The 2nd and 3rd parameters are used to define the output of the template if the condition is true or false, respectively. If not defined the default output is "yes" if true and empty if false.

Examples

Existing article (List of Doctor Who serials):

  • {{Ifexist not redirect|List of Doctor Who serials|true|false}}: false
  • {{#ifexist:List of Doctor Who serials|true|false}}: false

Redirect (List of Daredevil episodes):

  • {{Ifexist not redirect|List of Daredevil episodes|yes|no}}: no
  • {{#ifexist:List of Daredevil episodes|yes|no}}: no

Empty article (Template:Ifexist not redirect/testpage):

  • {{Ifexist not redirect|Template:Ifexist not redirect/testpage}}:
  • {{#ifexist:Template:Ifexist not redirect/testpage|yes}}: yes

Non-existant article (Green Arrow episodes):

  • {{Ifexist not redirect|Green Arrow episodes|1|0}}: 0
  • {{#ifexist:Green Arrow episodes|1|0}}: 0