模板:Ifexist not redirect/doc

维基百科,自由的百科全书
跳转到导航 跳转到搜索

Usage[编辑]

The {{Ifexist not redirect}} template can be used to identify a page which exists, is not blank, and is not a redirect; whereas {{If}} 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[编辑]

现有页面 (Wikipedia:首页):

  • {{Ifexist not redirect|Wikipedia:首页|true|false}}: false
  • {{#ifexist:Wikipedia:首页|true|false}}: false

重定向页面 (维基百科:主页):

  • {{Ifexist not redirect|維基百科:主頁|yes|no}}: no
  • {{#ifexist:維基百科:主頁|yes|no}}: yes

空页面 (Template:Ifexist not redirect/testpage):

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

不存在的页面 (123456789):

  • {{Ifexist not redirect|123456789|1|0}}: 0
  • {{#ifexist:123456789|1|0}}: 0

内定输出:

  • {{Ifexist not redirect|Wikipedia:首页}}:
  • {{Ifexist not redirect|維基百科:主頁}}: