Template:Link if exists/doc

Usage

[edit]

Positional parameters

[edit]
1
Title of page to link to. Wikilinked if an article exists, otherwise unlinked.
2
(optional) Text to display, defaults to positional parameter 1

Named parameters

[edit]
nsp
The namespace to try to link to (e.g., |nsp=Category). This namespace is not displayed.
prefix
A string to prefix the link. This prefix is displayed if a link is found.
color
Color of text if no link is found
hide_display
If page does not exist and if hide_display is non-empty, do not display anything

Examples

[edit]
  1. A page which exists:
    {{Link if exists|Japan}}Japan
  2. A page which does not exist:
    {{Link if exists|The exciting story of paint drying in a small town in Japan one day in April 1927}} → The exciting story of paint drying in a small town in Japan one day in April 1927
  3. Another page which exists, prefix specified:
    {{Link if exists|History|prefix=Portal}}Portal:History
  4. A page which does not exist, nsp specified:
    {{Link if exists|Computing in 1066|nsp=Portal}} → Computing in 1066
  5. Use of second positional parameter, page exists:
    {{Link if exists|target|word}}word
  6. Use of second positional parameter, page does not exist:
    {{Link if exists|agrp|,asmd}} → ,asmd
  7. Page does not exist, color parameter:
    {{Link if exists|agrp|color=#888}}agrp
  8. Page does not exist, hide_display parameter:
    {{Link if exists|agrp|hide_display=1}}

See also

[edit]

TemplateData

[edit]
This is the TemplateData for this template used by TemplateWizard, VisualEditor and other tools. See a monthly parameter usage report for Template:Link if exists in articles based on its TemplateData.

TemplateData for Link if exists

Link to a page if it exists, otherwise leave unwikilinked

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Title1

Title of page to link to

Page namerequired
Display2

Text to display

Default
Value of title parameter
Stringoptional
Namespacensp

The namespace of the title to link to

Suggested values
Template Category Wikipedia
Stringoptional
Prefixprefix

String to add a prefix to the title

Suggested values
Template Category Wikipedia
Stringoptional
Colorcolor

HTML color of text if no link is displayed

Stringoptional
Hide displayhide_display

If non-empty, hide display string if not existing

Booleanoptional