Difference between revisions of "Template:Linkexist/doc"
Jump to navigation
Jump to search
imported>علیرضا m |
imported>PrimeHunter (Fix template name. Add "NOTE: This template has confusing behaviour, poor incomplete documentation, and produces invalid wikitext in some cases". I have never added documentation like that but editors should be warned before trying to make sense of this) |
||
(One intermediate revision by one other user not shown) | |||
Line 2: | Line 2: | ||
<!-- Categories and interwikis go at the bottom of this page. --> | <!-- Categories and interwikis go at the bottom of this page. --> | ||
− | This template is a | + | NOTE: This template has confusing behaviour, poor incomplete documentation, and produces invalid wikitext in some cases. |
+ | |||
+ | The template is a way of creating optional links based on whether the target exists or not. | ||
It is presently used in {{tl|culture of region}}, as that template uses the logic in question so many times that transcluding it every time would lead to cluttered code. | It is presently used in {{tl|culture of region}}, as that template uses the logic in question so many times that transcluding it every time would lead to cluttered code. | ||
Line 9: | Line 11: | ||
<pre> | <pre> | ||
− | {{ | + | {{linkexist|page|linktext|alternative}} |
</pre> | </pre> | ||
− | If <code>alternative</code> is specified, the template will link to that | + | If <code>alternative</code> is specified, the template will link to that title. Otherwise, the template will link to <code>page</code> if it exists. <code>linktext</code>, if specified, will be the label for the link (or unlinked output). |
== Examples == | == Examples == | ||
Line 30: | Line 32: | ||
== See also == | == See also == | ||
− | <includeonly> | + | <includeonly>{{Sandbox other|| |
<!-- Categories and interwikis go here: --> | <!-- Categories and interwikis go here: --> | ||
[[Category:Wikipedia utility templates]] | [[Category:Wikipedia utility templates]] | ||
− | </includeonly> | + | }}</includeonly> |
Latest revision as of 18:46, 8 February 2021
![]() | This is a documentation subpage for Template:Linkexist. It contains usage information, categories and other content that is not part of the original template page. |
NOTE: This template has confusing behaviour, poor incomplete documentation, and produces invalid wikitext in some cases.
The template is a way of creating optional links based on whether the target exists or not.
It is presently used in {{culture of region}}, as that template uses the logic in question so many times that transcluding it every time would lead to cluttered code.
Usage
{{linkexist|page|linktext|alternative}}
If alternative
is specified, the template will link to that title. Otherwise, the template will link to page
if it exists. linktext
, if specified, will be the label for the link (or unlinked output).
Examples
{{linkexist|History of Ghana}}
{{linkexist|History of Ghana|History}}
{{linkexist|History of Ghana|History|Culture of Ghana}}