| 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}}.
| | Example |
| =Overview=
| |
| Outputs an icon in svg and a link to the given localized page with an optional alternate display name.
| |
|
| |
|
| Output will be:<br>
| | {{PageRef|Lash}} |
| <icon> <pagename>
| |
|
| |
|
| * Both icon and page name will be hyperlinked to first parameter as the pagename
| | {{PageRef|Lash|alt=Jacob}} |
| * 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)
| |
| ***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)
| |
| ** 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.
| | {{PageRef|Siphon Life|size=50}} |
|
| |
|
| =Examples=
| | {{PageRef|AttributeIconTechDuration}} |
| In its simplest form: <code><nowiki>{{PageRef|Lash}}</nowiki></code> {{PageRef|Lash}}
| |
|
| |
|
| Example where the icon doesn't exist: <code><nowiki>{{PageRef|Shopkeeper}}</nowiki></code> {{PageRef|Shopkeeper}}
| | {{PageRef|Basic Magazine}} |
|
| |
|
| Using alt_name: <code><nowiki>{{PageRef|Lash|alt_name=Jacob}}</nowiki></code> {{PageRef|Lash|alt_name=Jacob}}
| | {{PageRef|The Curiosity Shop|alt=Shop|size=100}} |
|
| |
|
| Using alt_link (hover the link to see): <code><nowiki>{{PageRef|Lash|alt_link=Cold Front}}</nowiki></code> {{PageRef|Lash|alt_link=Cold Front}}
| |
|
| |
| 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:
| |
| <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.
| |
|
| |
| If a file does not exist, it will look like
| |
| {{PageRef|My cool page}}
| |
|
| |
| To not use the file, use:
| |
| <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):
| |
| <code><nowiki>{{PageRef|Lash|lang=/ru}}</nowiki></code>
| |
| {{PageRef|Lash|lang=/ru}}
| |
|
| |
| =Parameters=
| |
| <templatedata> | | <templatedata> |
| { | | { |
| "params": {
| | "description": "Template that outputs an icon in svg and a link to the given page with an optional alternate display name.", |
| "name": {
| | "params": { |
| "label": "Name",
| | "name": { |
| "description": "The localized name of the page to link to, also used to determine the icon.",
| | "label": "Name", |
| "required": true,
| | "description": "The name of the page to link to, also used to determine the icon.", |
| "example": "Lash",
| | "type": "string", |
| "aliases": [
| | "required": true, |
| "1"
| | "example": "Lash" |
| ],
| | }, |
| "type": "string"
| | "alt": { |
| },
| | "label": "Alternate Name", |
| "no_file": {
| | "description": "An optional display name to show instead of the page name in the link.", |
| "label": "Do not use file",
| | "type": "string", |
| "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",
| | "required": false, |
| "required": false,
| | "example": "Jacob" |
| "example": "true",
| | }, |
| "type": "string"
| | "size": { |
| },
| | "label": "Size", |
| "alt_name": {
| | "description": "Size of the icon link, defaulted to 15px", |
| "label": "Alternate Name",
| | "type": "number", |
| "description": "An optional display name to show instead of the page name in the link.",
| | "required": false, |
| "type": "string",
| | "example": "50" |
| "required": false,
| | } |
| "example": "Jacob"
| | }, |
| },
| | "format": "inline" |
| "alt_link": {
| |
| "label": "Alternate Link",
| |
| "description": "An optional link to link to instead of the 1st parameter (name).",
| |
| "type": "string",
| |
| "required": false,
| |
| "example": "Death Slam"
| |
| },
| |
| "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> |