Template:PageRef/doc: Difference between revisionsGive feedback
Gammaton32 (talk | contribs) No edit summary |
Gammaton32 (talk | contribs) more details |
||
| (4 intermediate revisions by 3 users not shown) | |||
| 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. | ||
| Line 14: | Line 15: | ||
** 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 | ** 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= | ||
| Line 38: | Line 40: | ||
<code><nowiki>{{PageRef|My cool page|no_file=true}}</nowiki></code> | <code><nowiki>{{PageRef|My cool page|no_file=true}}</nowiki></code> | ||
{{PageRef|My cool page|no_file=true}} | {{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= | =Parameters= | ||
| Line 53: | Line 59: | ||
"type": "string" | "type": "string" | ||
}, | }, | ||
"no_file": { | |||
"label": "Do not use file", | |||
"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, | |||
"example": "true", | |||
"type": "string" | |||
}, | |||
"alt_name": { | "alt_name": { | ||
"label": "Alternate Name", | "label": "Alternate Name", | ||
| Line 83: | Line 89: | ||
"size": { | "size": { | ||
"label": "Size", | "label": "Size", | ||
"description": "Size of the icon link, defaulted to ' | "description": "Size of the icon link, defaulted to '20'px", | ||
"type": "number", | "type": "number", | ||
"required": false, | "required": false, | ||
"example": "50" | "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" | |||
} | } | ||
}, | }, | ||