Template:Linkifexists: Difference between revisions

From Unofficial Homecoming Wiki
Jump to navigation Jump to search
imported>Sekoia
No edit summary
imported>Sekoia
(attempting to update to use {{exists}})
Line 1: Line 1:
{{#ifexist:{{{page|{{{1}}}}}}|[[{{{page|{{{1}}}}}}|{{{name|{{{2|{{{page|{{{1}}}}}}}}}}}}]]|{{{name|{{{2|{{{page|{{{1}}}}}}}}}}}}}}<noinclude>{{documentation}}</noinclude>
{{exists|page={{{page|{{{1}}}}}}|then=[[{{{page|{{{1}}}}}}|{{{name|{{{2|{{{page|{{{1}}}}}}}}}}}}]]|else={{{name|{{{2|{{{page|{{{1}}}}}}}}}}}}}}<noinclude>{{documentation}}</noinclude>

Revision as of 00:51, 4 April 2013

[[{{{1}}}|{{{1}}}]]

[edit] [purge] Documentation

Usage

This will link to a page if the target exists. Otherwise, it will just display the name without a link. There are several ways to call it:

  • {{linkifexists|Page Name}}
  • {{linkifexists|Page Name|Display Name}}
  • {{linkifexists|page=Page Name}}
  • {{linkifexists|page=Page Name|name=Display Name}}

Examples

Target Exists Target Doesn't Exist
Template Call Result Template Call Result
{{linkifexists|Main Page}} Main Page {{linkifexists|Fake Page}} Fake Page
{{linkifexists|Main Page|Home}} Home {{linkifexists|Fake Page|Home}} Home
{{linkifexists|page=Main Page}} Main Page {{linkifexists|page=Fake Page}} Fake Page
{{linkifexists|page=Main Page|name=Home}} Home {{linkifexists|page=Fake Page|name=Home}} Home