VOOZH about

URL: https://en.wikipedia.org/wiki/Template:Auto_link

⇱ Template:Link if exists - Wikipedia


Jump to content
From Wikipedia, the free encyclopedia
(Redirected from Template:Auto link)
👁 Image
Template documentation
[view] [edit] [history] [purge]
👁 Warning
This template is used on approximately 291,000 pages.
To avoid major disruption and server load, any changes should be tested in the template's /sandbox or /testcases subpages, or in your own user subpage. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them.
👁 Image
Due to a server limit of 500 "expensive parser function" calls (e.g. #ifexist:, PAGESIZE:, and PAGESINCATEGORY:), this template will only work properly if the page using it has not already exceeded the limit. When the limit is exceeded, the page using this template or module is categorised in Category:Pages with too many expensive parser function calls. (further information)
👁 Image
This template uses Lua:

Usage

Positional parameters

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

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

  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

TemplateData

This is the TemplateData for this template used by TemplateWizard, VisualEditor and other tools. See a monthly parameter usage report for in articles based on its TemplateData.

TemplateData for Link if exists

Template parameters[Edit template data]

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