Template:AutoLink: Difference between revisions
Template page
More actions
| [checked revision] | [checked revision] |
Created page with "<includeonly>{{#switch:{{{type|}}} | players = {{#ifexist:Players/{{{target}}}|[[Players/{{{target}}}|{{{text|{{{target}}}}}}]]|{{{text|{{{target}}}}}}}} | places = [[Places/{{{target}}}|{{{text|{{{target}}}}}}]] | groups = [[Groups/{{{target}}}|{{{text|{{{target}}}}}}]] | businesses = [[Businesses/{{{target}}}|{{{text|{{{target}}}}}}]] | #default = {{{text|{{{target}}}}}} }}</includeonly><noinclude> = AutoLink Template = This is a unified auto-linking template that can..." |
Rename places→locations; add existence checks for groups/businesses; add political_parties, events, locations types |
||
| (One intermediate revision by one other user not shown) | |||
| Line 1: | Line 1: | ||
<includeonly>{{#switch:{{{type|}}} | <includeonly>{{#switch:{{{type|}}} | ||
| players = {{#ifexist:Players/{{{target}}}|[[Players/{{{target}}}|{{{text|{{{target}}}}}}]]|{{{text|{{{target}}}}}}}} | | players = {{#ifexist:Players/{{{target}}}|[[Players/{{{target}}}|{{{text|{{{target}}}}}}]]|{{{text|{{{target}}}}}}}} | ||
| | | characters = {{#ifexist:Characters/{{{target}}}|[[Characters/{{{target}}}|{{{text|{{{target}}}}}}]]|{{{text|{{{target}}}}}}}} | ||
| groups = [[Groups/{{{target}}}|{{{text|{{{target}}}}}}]] | | groups = {{#ifexist:Groups/{{{target}}}|[[Groups/{{{target}}}|{{{text|{{{target}}}}}}]]|{{{text|{{{target}}}}}}}} | ||
| businesses = [[Businesses/{{{target}}}|{{{text|{{{target}}}}}}]] | | businesses = {{#ifexist:Businesses/{{{target}}}|[[Businesses/{{{target}}}|{{{text|{{{target}}}}}}]]|{{{text|{{{target}}}}}}}} | ||
| political_parties = {{#ifexist:Political_Parties/{{{target}}}|[[Political_Parties/{{{target}}}|{{{text|{{{target}}}}}}]]|{{{text|{{{target}}}}}}}} | |||
| locations = {{#ifexist:Locations/{{{target}}}|[[Locations/{{{target}}}|{{{text|{{{target}}}}}}]]|{{{text|{{{target}}}}}}}} | |||
| events = {{#ifexist:Events/{{{target}}}|[[Events/{{{target}}}|{{{text|{{{target}}}}}}]]|{{{text|{{{target}}}}}}}} | |||
| #default = {{{text|{{{target}}}}}} | | #default = {{{text|{{{target}}}}}} | ||
}}</includeonly><noinclude> | }}</includeonly><noinclude> | ||
= AutoLink Template = | = AutoLink Template = | ||
Unified auto-linking template. Creates a wiki link to an entity page if it exists, otherwise renders as plain text. | |||
== Usage == | == Usage == | ||
| Line 14: | Line 17: | ||
== Parameters == | == Parameters == | ||
* '''type''' | * '''type''' — entity type (see table below) | ||
* '''target''' | * '''target''' — exact page identifier (without the prefix) | ||
* '''text''' | * '''text''' — optional display text (defaults to target name) | ||
== Supported Types == | == Supported Types == | ||
{| class="wikitable" | |||
! Type value !! Links to !! Existence check? | |||
|- | |||
| <code>players</code> || <code>Players/{target}</code> || Yes | |||
|- | |||
| <code>characters</code> || <code>Characters/{target}</code> || Yes | |||
|- | |||
| <code>groups</code> || <code>Groups/{target}</code> || Yes | |||
|- | |||
| <code>businesses</code> || <code>Businesses/{target}</code> || Yes | |||
|- | |||
| <code>political_parties</code> || <code>Political_Parties/{target}</code> || Yes | |||
|- | |||
| <code>locations</code> || <code>Locations/{target}</code> || Yes | |||
|- | |||
| <code>events</code> || <code>Events/{target}</code> || Yes | |||
|} | |||
All types fall back to plain text if the target page does not exist yet. | |||
== Examples == | == Examples == | ||
| Line 38: | Line 46: | ||
→ [[Players/Falcon40k|Falcon40k]] | → [[Players/Falcon40k|Falcon40k]] | ||
<code><nowiki>{{AutoLink|type= | <code><nowiki>{{AutoLink|type=characters|target=Abraham Ivankov-Chevalier|text=the boss}}</nowiki></code> | ||
→ [[ | → [[Characters/Abraham Ivankov-Chevalier|the boss]] | ||
<code><nowiki>{{AutoLink|type= | <code><nowiki>{{AutoLink|type=groups|target=Ivankov-Chevalier Family}}</nowiki></code> | ||
→ [[ | → [[Groups/Ivankov-Chevalier Family|Ivankov-Chevalier Family]] | ||
<code><nowiki>{{AutoLink|type= | <code><nowiki>{{AutoLink|type=locations|target=Takashima Central Station}}</nowiki></code> | ||
→ [[ | → [[Locations/Takashima Central Station|Takashima Central Station]] | ||
</noinclude> | </noinclude> | ||
Latest revision as of 07:41, 11 June 2026
AutoLink Template
Unified auto-linking template. Creates a wiki link to an entity page if it exists, otherwise renders as plain text.
Usage
{{AutoLink|type=TYPE|target=TARGET_NAME|text=DISPLAY_TEXT}}
Parameters
- type — entity type (see table below)
- target — exact page identifier (without the prefix)
- text — optional display text (defaults to target name)
Supported Types
| Type value | Links to | Existence check? |
|---|---|---|
players |
Players/{target} |
Yes |
characters |
Characters/{target} |
Yes |
groups |
Groups/{target} |
Yes |
businesses |
Businesses/{target} |
Yes |
political_parties |
Political_Parties/{target} |
Yes |
locations |
Locations/{target} |
Yes |
events |
Events/{target} |
Yes |
All types fall back to plain text if the target page does not exist yet.
Examples
{{AutoLink|type=players|target=Falcon40k}}
→ Falcon40k
{{AutoLink|type=characters|target=Abraham Ivankov-Chevalier|text=the boss}}
→ the boss
{{AutoLink|type=groups|target=Ivankov-Chevalier Family}}
→ Ivankov-Chevalier Family
{{AutoLink|type=locations|target=Takashima Central Station}}
→ Takashima Central Station