Template:AutoLink: Difference between revisions
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..." |
mNo edit summary |
||
| 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}}}}}}}} | |||
| places = [[Places/{{{target}}}|{{{text|{{{target}}}}}}]] | | places = [[Places/{{{target}}}|{{{text|{{{target}}}}}}]] | ||
| groups = [[Groups/{{{target}}}|{{{text|{{{target}}}}}}]] | | groups = [[Groups/{{{target}}}|{{{text|{{{target}}}}}}]] | ||
| Line 8: | Line 9: | ||
= AutoLink Template = | = AutoLink Template = | ||
This is a unified auto-linking template that can create links to different types of entities (players, places, groups, businesses, etc.). | This is a unified auto-linking template that can create links to different types of entities (players, characters, places, groups, businesses, etc.). | ||
== Usage == | == Usage == | ||
| Line 14: | Line 15: | ||
== Parameters == | == Parameters == | ||
* '''type''' - The type of entity to link to (players, places, groups, businesses) | * '''type''' - The type of entity to link to (players, characters, places, groups, businesses) | ||
* '''target''' - The exact name/identifier of the entity to link to | * '''target''' - The exact name/identifier of the entity to link to | ||
* '''text''' - Optional display text (defaults to target name if not provided) | * '''text''' - Optional display text (defaults to target name if not provided) | ||
| Line 23: | Line 24: | ||
Links to player pages in the Players/ directory: | Links to player pages in the Players/ directory: | ||
* Checks if Players/{target} exists | * 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 | * If it exists, creates a link; otherwise displays as plain text | ||
| Line 40: | Line 46: | ||
<code><nowiki>{{AutoLink|type=players|target=Falcon40k|text=my friend}}</nowiki></code> | <code><nowiki>{{AutoLink|type=players|target=Falcon40k|text=my friend}}</nowiki></code> | ||
→ [[Players/Falcon40k|my friend]] | → [[Players/Falcon40k|my friend]] | ||
<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> | <code><nowiki>{{AutoLink|type=places|target=Tokyo|text=the capital}}</nowiki></code> | ||
| Line 46: | Line 58: | ||
<code><nowiki>{{AutoLink|type=businesses|target=SushiCorp}}</nowiki></code> | <code><nowiki>{{AutoLink|type=businesses|target=SushiCorp}}</nowiki></code> | ||
→ [[Businesses/SushiCorp|SushiCorp]] | → [[Businesses/SushiCorp|SushiCorp]] | ||
== Advantages == | |||
* No need to follow specific text patterns | |||
* 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 21:26, 4 September 2025
AutoLink Template
This is a unified auto-linking template that can create links to different types of entities (players, characters, places, groups, businesses, etc.).
Usage
{{AutoLink|type=TYPE|target=TARGET_NAME|text=DISPLAY_TEXT}}
Parameters
- type - The type of entity to link to (players, characters, places, groups, businesses)
- target - The exact name/identifier of the entity to link to
- text - Optional display text (defaults to target name if not provided)
Supported Types
Players (type=players)
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
{{AutoLink|type=players|target=Falcon40k}}
→ Falcon40k
{{AutoLink|type=players|target=Falcon40k|text=my friend}}
→ my friend
{{AutoLink|type=characters|target=John Tanaka}}
→ John Tanaka
{{AutoLink|type=characters|target=Jane Smith|text=his sister}}
→ his sister
{{AutoLink|type=places|target=Tokyo|text=the capital}}
→ the capital
{{AutoLink|type=businesses|target=SushiCorp}}
→ SushiCorp
Advantages
- No need to follow specific text patterns
- Explicit control over what gets linked
- Flexible display text
- Works with any entity name
- Easy to extend for new types