Editing Template:PageRef/doc

Warning: You are not logged in. Once you make an edit, a temporary account will be created for you. Learn more. Log in or create an account to continue receiving notifications after this account expires, and to access other features.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision Your text
Line 1: Line 1:
Note: It's recommended to use {{tl|HeroIcon}}, {{tl|AbilityIcon}}, or {{tl|ItemIcon}} instead, as those templates use [[Module:Icon]] and thus allow for more elaborate functions such as custom previews. PageRef should only be used for icons not covered in those templates, i.e. {{PageRef|Hidden King}} or {{PageRef|Shopkeeper}}.
=Overview=
=Overview=
Outputs an icon in svg and a link to the given localized page with an optional alternate display name.
Outputs an icon in svg and a link to the given localized page with an optional alternate display name.


Output will be:<br>
Output should be:<br>
<icon> <pagename>
<icon> <pagename>


* Both icon and page name will be hyperlinked to first parameter as the pagename
* Both icon and page name should be hyperlinked to first parameter as the pagename
* Icon should be <pre style="width: fit-content>[[File:<pagename>.svg]]</pre> if the svg file exists, otherwise the .png.  
* Icon should be <pre style="width: fit-content>[[File:<pagename>.svg]]</pre> if the svg file exists, otherwise the .png.  
** The .svg should be both light and dark theme compatible (WIP)
* The .svg should be both light and dark theme compatible
***It's possible CSS may be used to automatically invert colors, precluding the need for the icon to be theme-compatible
** It's possible CSS may be used to automatically invert colors, precluding the need for the icon to be theme-compatible
** The .png should at least be default theme compatible (dark)
* The .png should be default theme compatible (light)
** If neither the .svg nor the .png exist, the icon will not be added
* If the first parameter (name) is a hero name in english, it will automatically use the <hero>_MM.png file
** Otherwise, if the file name is different to the page name (do not use this in excess), the <i>alt_file_name</i> parameter will need to be used


The code for this template is at [[Module:PageRef]]. The module also lists exceptions for pages that currently do not have an icon uploaded, so that templates such as [[Template:VoiceLineCite]] do not use a broken image link. If an icon for those pages is added, they should be removed from the exceptions list.
=Examples=


=Examples=
{{PageRef|Lash|alt_name=Jacob}}
In its simplest form: <code><nowiki>{{PageRef|Lash}}</nowiki></code> {{PageRef|Lash}}
{{PageRef|Bullet Lifesteal|alt_link=Bullet Lifesteal (item)}}
{{PageRef|Siphon Life|alt_link=Abrams#(1) Siphon Life}}
 
==not yet working==
 
{{PageRef|Lash|alt_name=Jacob}}
 
{{PageRef|Siphon Life|size=50}}


Example where the icon doesn't exist: <code><nowiki>{{PageRef|Shopkeeper}}</nowiki></code> {{PageRef|Shopkeeper}}
{{PageRef|AttributeIconTechDuration}}


Using alt_name: <code><nowiki>{{PageRef|Lash|alt_name=Jacob}}</nowiki></code> {{PageRef|Lash|alt_name=Jacob}}
{{PageRef|Basic Magazine}}


Using alt_link (hover the link to see): <code><nowiki>{{PageRef|Lash|alt_link=Cold Front}}</nowiki></code> {{PageRef|Lash|alt_link=Cold Front}}
{{PageRef|The Curiosity Shop|alt_name=Shop|size=100}}


Using alt_file_name: <code><nowiki>{{PageRef|Lash|alt_file_name=Cold Front}}</nowiki></code> {{PageRef|Lash|alt_file_name=Cold Front}}


Using them all together, note that the first parameter is no longer used and therefore not needed:  
Below is a fake example. Ideally, the template is called like:
<code><nowiki>{{PageRef|alt_name=Cold Front|alt_link=Cold Front|alt_file_name=Cold Front}}</nowiki></code>
{{PageRef|alt_name=Cold Front|alt_link=Cold Front|alt_file_name=Cold Front}}


Note: Instead of repeated use of <i>alt_file_name</i>, it is recommended to create a redirect at <nowiki>[[<first_parameter>.png]]</nowiki> to <nowiki>[[<alt_file_name>.png]]</nowiki>, allowing the use of the simplest form of PageRef, making it much easier to reference in the future.
<pre style="width: fit-content">{{PageRef|Lash|alt_name=Jacob}}</pre>


If a file does not exist, it will look like
In wikitext it would look be outputted as:
{{PageRef|My cool page}}
<pre style="width: fit-content">[[File:Lash.svg|class=dark_or_light|link=Lash|size=15]] [[Lash|Jacob]]</pre>


To not use the file, use:
Which would appear in visual as
<code><nowiki>{{PageRef|My cool page|no_file=true}}</nowiki></code>
{{PageRef|My cool page|no_file=true}}


Using lang with to override language (e.g., Russian):
{{HeroIcon|Lash|Jacob}}
<code><nowiki>{{PageRef|Lash|lang=/ru}}</nowiki></code>
{{PageRef|Lash|lang=/ru}}


=Parameters=
<templatedata>
<templatedata>
{
{
"params": {
    "params": {
"name": {
        "name": {
"label": "Name",
            "label": "Name",
"description": "The localized name of the page to link to, also used to determine the icon.",
            "description": "The localized name of the page to link to, also used to determine the icon.",
"required": true,
            "type": "string",
"example": "Lash",
            "required": true,
"aliases": [
            "example": "Lash"
"1"
        },
],
        "alt_name": {
"type": "string"
            "label": "Alternate Name",
},
            "description": "An optional display name to show instead of the page name in the link.",
"no_file": {
            "type": "string",
"label": "Do not use file",
            "required": false,
"description": "Do not use any file; also use this parameter when a file doesn't exist. Note that passing 'false' does not make it use a file, the parameter must then be omitted. This is for code efficiency",
            "example": "Jacob"
"required": false,
        },
"example": "true",
        "alt_link": {
"type": "string"
            "label": "Alternate Link",
},
            "description": "An optional link to link to instead of the 1st parameter (name).",
"alt_name": {
            "type": "string",
"label": "Alternate Name",
            "required": false,
"description": "An optional display name to show instead of the page name in the link.",
            "example": "Death Slam"
"type": "string",
        },
"required": false,
        "size": {
"example": "Jacob"
            "label": "Size",
},
            "description": "Size of the icon link, defaulted to '15'px",
"alt_link": {
            "type": "number",
"label": "Alternate Link",
            "required": false,
"description": "An optional link to link to instead of the 1st parameter (name).",
            "example": "50"
"type": "string",
        }
"required": false,
    },
"example": "Death Slam"
    "format": "inline"
},
"alt_file_name": {
"label": "Alternate File Name",
"description": "An optional way to designate which file to include. Not needed if <first parameter> (name) is the same as the file name. File extension not needed, as it will try to prioritize the .svg first, otherwise use the .png.",
"type": "string",
"required": false,
"example": "Amber Hand.png"
},
"size": {
"label": "Size",
"description": "Size of the icon link, defaulted to '20'px",
"type": "number",
"required": false,
"example": "50"
},
"lang": {
"label": "Language",
"description": "An optional language code to override the default language suffix in links (e.g., '/ru', '/zh-hans'). If omitted, `If_lang` template is used.",
"example": "/ru",
"type": "string"
}
},
"format": "inline"
}
}
</templatedata>
</templatedata>
Please note that all contributions to The Deadlock Wiki are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see Deadlock:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!
Cancel Editing help (opens in new window)
Preview page with this template

Pages included on this page:

This page is a member of a hidden category: