Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:AutoLink: Difference between revisions

Template page
[checked revision][checked revision]
mNo edit summary
Rename places→locations; add existence checks for groups/businesses; add political_parties, events, locations types
 
Line 2: Line 2:
| 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}}}}}}}}
| characters = {{#ifexist:Characters/{{{target}}}|[[Characters/{{{target}}}|{{{text|{{{target}}}}}}]]|{{{text|{{{target}}}}}}}}
| places = [[Places/{{{target}}}|{{{text|{{{target}}}}}}]]
| groups = {{#ifexist:Groups/{{{target}}}|[[Groups/{{{target}}}|{{{text|{{{target}}}}}}]]|{{{text|{{{target}}}}}}}}
| groups = [[Groups/{{{target}}}|{{{text|{{{target}}}}}}]]
| businesses = {{#ifexist:Businesses/{{{target}}}|[[Businesses/{{{target}}}|{{{text|{{{target}}}}}}]]|{{{text|{{{target}}}}}}}}
| businesses = [[Businesses/{{{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 =


This is a unified auto-linking template that can create links to different types of entities (players, characters, places, groups, businesses, etc.).
Unified auto-linking template. Creates a wiki link to an entity page if it exists, otherwise renders as plain text.


== Usage ==
== Usage ==
Line 15: Line 17:


== Parameters ==
== Parameters ==
* '''type''' - The type of entity to link to (players, characters, places, groups, businesses)
* '''type''' — entity type (see table below)
* '''target''' - The exact name/identifier of the entity to link to
* '''target''' exact page identifier (without the prefix)
* '''text''' - Optional display text (defaults to target name if not provided)
* '''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
|}


=== Players (type=players) ===
All types fall back to plain text if the target page does not exist yet.
Links to player pages in the Players/ directory:
* Checks if Players/{target} exists
* If it exists, creates a link; otherwise displays as plain text
 
=== Characters (type=characters) ===
Links to character pages in the Characters/ directory:
* Checks if Characters/{target} exists
* If it exists, creates a link; otherwise displays as plain text
 
=== Places (type=places) ===
Links to Places/{target}
 
=== Groups (type=groups) ===
Links to Groups/{target}
 
=== Businesses (type=businesses) ===
Links to Businesses/{target}


== Examples ==
== Examples ==
Line 44: Line 46:
→ [[Players/Falcon40k|Falcon40k]]
→ [[Players/Falcon40k|Falcon40k]]


<code><nowiki>{{AutoLink|type=players|target=Falcon40k|text=my friend}}</nowiki></code>
<code><nowiki>{{AutoLink|type=characters|target=Abraham Ivankov-Chevalier|text=the boss}}</nowiki></code>
→ [[Players/Falcon40k|my friend]]
→ [[Characters/Abraham Ivankov-Chevalier|the boss]]
 
<code><nowiki>{{AutoLink|type=characters|target=John Tanaka}}</nowiki></code>
→ [[Characters/John Tanaka|John Tanaka]]
 
<code><nowiki>{{AutoLink|type=characters|target=Jane Smith|text=his sister}}</nowiki></code>
→ [[Characters/Jane Smith|his sister]]
 
<code><nowiki>{{AutoLink|type=places|target=Tokyo|text=the capital}}</nowiki></code>
→ [[Places/Tokyo|the capital]]


<code><nowiki>{{AutoLink|type=businesses|target=SushiCorp}}</nowiki></code>
<code><nowiki>{{AutoLink|type=groups|target=Ivankov-Chevalier Family}}</nowiki></code>
→ [[Businesses/SushiCorp|SushiCorp]]
→ [[Groups/Ivankov-Chevalier Family|Ivankov-Chevalier Family]]


== Advantages ==
<code><nowiki>{{AutoLink|type=locations|target=Takashima Central Station}}</nowiki></code>
* No need to follow specific text patterns
→ [[Locations/Takashima Central Station|Takashima Central Station]]
* Explicit control over what gets linked
* Flexible display text
* Works with any entity name
* Easy to extend for new types
</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