Template:Item link/doc: Difference between revisions
>OmegaK2 m (→Basic Usage) |
(→Large icons: removed language interwikis) |
||
(26 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
{{ | {{Documentation subpage}} | ||
{{ | {{Lua|Module:Item link}} | ||
{{Template shortcut|il}} | |||
Query based item link. Use this to link items from [[Template:Item]] | |||
==Overview== | ==Overview== | ||
Creates a link to an item page that has the item information entered by [[Template:Item]] and includes the item info box on hover on the link. | Creates a link to an item page that has the item information entered by [[Template:Item]] and includes the item info box on hover on the link. | ||
Line 13: | Line 13: | ||
==Parameters== | ==Parameters== | ||
=== | ===Item selection=== | ||
One of these is required. Do not specify more than one. | |||
{| class="wikitable" | |||
{| class="wikitable | |||
! Parameter | ! Parameter | ||
! Value | ! Value | ||
! Description | ! Description | ||
|- | |||
| metadata_id | |||
| str | |||
| Metadata ID of the item to search for | |||
|- | |- | ||
| page | | page | ||
| str | | str | ||
| Name of the wiki page | | Name of the wiki page on which the item data resides | ||
|- | |- | ||
| item_name | | item_name | ||
| str | | str | ||
| Name of the item to search for. | | Name of the item to search for. The search query will also extend to aliases of the item (e.g., legacy names). | ||
The search may fail if there are multiple items with the given name. In that case, use a different item selection parameter, such as <code>page</code>. | |||
|- | |- | ||
| item_name_exact | | item_name_exact | ||
| str | | str | ||
| Exact name of the item to search for. | | Exact name of the item to search for. | ||
The search may fail if there are multiple items with the given name. In that case, use a different item selection parameter, such as <code>page</code>. | |||
|} | |} | ||
Line 61: | Line 52: | ||
| name | | name | ||
| str | | str | ||
| | | This parameter can be used to specify different link text than the item name. This should be used mainly for grammatical purposes. If the link text is significantly different than the item name, consider using a normal wikilink instead of this template. | ||
An empty value can be specified to avoid displaying a text link entirely; the link will consist of only the item icon. | |||
|- | |- | ||
| large | | large | ||
Line 77: | Line 62: | ||
| image | | image | ||
| str or int | | str or int | ||
| This can be used to link against an alternate art version of an item. | | This can be used to link against an [[alternate art]] version of an item. | ||
Depending on which type is supplied: | Depending on which type is supplied: | ||
* int: choose the alternate art based on the index (i.e. 1 for the first alternate art, 2 for the second, etc) | * int: choose the alternate art based on the index (i.e. 1 for the first alternate art, 2 for the second, etc) | ||
* str: choose the alternate based on the string given (i.e. "race season 1" would search for <code><nowiki>File:<itemname> race season 1 inventory icon.png</nowiki></code> and use it as image) | * str: choose the alternate based on the string given (i.e. "race season 1" would search for <code><nowiki>File:<itemname> race season 1 inventory icon.png</nowiki></code> and use it as image) | ||
|- | |||
| html | |||
| str | |||
| HTML to use for the itembox. | |||
May also be used to hide the item box entirely. | |||
|- | |||
| inventory_icon | |||
| str | |||
| File to use for the inline icon link. | |||
|- | |||
| skip_query | |||
| boolean | |||
| Skip querying for the item. | |||
|- | |||
| link | |||
| str | |||
| Which page to link to. This parameter can only be used if <code>skip_query=true</code>. | |||
|} | |} | ||
==Errors== | |||
===No pages found=== | |||
When the search parameters can't find any items for the given parameter, a red error box will be shown. It can be caused by updates to the game that change the name of items, so links to the old name can no longer find the item with the new name. | |||
The solution is to either use a different search parameter or making sure the parameter is correct. | |||
'''Example:''' | |||
Broken: <code><nowiki>{{Item link|item_name_exact=Pierce}}</nowiki></code> {{Item link|item_name_exact=Pierce|nocat=1}} | |||
Fixed: <code><nowiki>{{Item link|item_name_exact=Pierce Support}}</nowiki></code> {{Item link|item_name_exact=Pierce Support}} | |||
In rare cases, it's also possible it's caused by Database problems causing data to not be written on the target page. In those cases, [[wikipedia:Wikipedia:null edit|null editing]] the target page should help. See [[Path of Exile Wiki:Known issues]] for more information. | |||
===Too many results found=== | |||
When the search parameters find to many items, a red error box will be shown because the script doesn't know which one is the desired result. It is generally caused by items that share the same name, but have their own page such as variants of an unique item for example. | |||
The solution is to use the page parameter to point to the page of the desired item. | |||
'''Example:''' | |||
Broken: <code><nowiki>{{Item link|item_name_exact=Two-Stone Ring}}</nowiki></code> {{Item link|item_name_exact=Two-Stone Ring|nocat=1}} | |||
Fixed: <code><nowiki>{{Item link|page=Two-Stone Ring (ruby and topaz)}}</nowiki></code> {{Item link|page=Two-Stone Ring (ruby and topaz)}} | |||
In rare cases, it's also possible it's caused by Database problems causing duplicate data on the target page. In those cases, [[wikipedia:Wikipedia:null edit|null editing]] the target page should help. See [[Path of Exile Wiki:Known issues]] for more information. | |||
===Note=== | |||
In some case, fixing the error requires to pipe the name to reflect the original wording and context such as in the patch notes section: | |||
Broken: <code><nowiki>{{Item link|Projectiles Weakness }}</nowiki></code> {{Item link|Projectiles Weakness|nocat=1}} | |||
Fixed: <code><nowiki>{{Item link|Sniper's Mark|Projectiles Weakness}}</nowiki></code> {{Item link|Sniper's Mark|Projectiles Weakness}} | |||
==Examples== | ==Examples== | ||
===Basic Usage=== | ===Basic Usage=== | ||
<pre>{{Item link | <pre>{{Item link | ||
|page=Two-Stone Ring (ruby and topaz) | |page=Two-Stone Ring (ruby and topaz) | ||
Line 98: | Line 133: | ||
<pre>{{Item link | <pre>{{Item link | ||
| | |item_name=Pierce Support | ||
}}</pre> | }}</pre> | ||
Line 104: | Line 139: | ||
{{Item link | {{Item link | ||
|item_name=Pierce | |item_name=Pierce Support | ||
}} | }} | ||
===Large icons=== | ===Large icons=== | ||
<pre>{{Item link | <pre>{{Item link | ||
| | |item_name=Pierce Support | ||
|large=yes | |large=yes | ||
}}</pre> | }}</pre> | ||
Line 117: | Line 151: | ||
{{Item link | {{Item link | ||
|item_name=Pierce | |item_name=Pierce Support | ||
|large=yes | |large=yes | ||
}} | }} | ||
< | {{Documentation categories| | ||
[[Category: | <!-- Categories and interwikis go here. --> | ||
[[Category:Link formatting templates]] | |||
[[Category:Query templates]] | |||
[[Category:Item templates]] | [[Category:Item templates]] | ||
}} |
Latest revision as of 16:17, 2 October 2024
This subpage provides documentation for Template:Item link.
Query based item link. Use this to link items from Template:Item
Overview
Creates a link to an item page that has the item information entered by Template:Item and includes the item info box on hover on the link.
Pages with broken item links with be added to the maintenance category Category:Pages with broken item links.
Parameters
Item selection
One of these is required. Do not specify more than one.
Parameter | Value | Description |
---|---|---|
metadata_id | str | Metadata ID of the item to search for |
page | str | Name of the wiki page on which the item data resides |
item_name | str | Name of the item to search for. The search query will also extend to aliases of the item (e.g., legacy names).
The search may fail if there are multiple items with the given name. In that case, use a different item selection parameter, such as |
item_name_exact | str | Exact name of the item to search for.
The search may fail if there are multiple items with the given name. In that case, use a different item selection parameter, such as |
Output overrides
All of these are optional and can be used to customize the item link.
Parameter | Value | Description |
---|---|---|
name | str | This parameter can be used to specify different link text than the item name. This should be used mainly for grammatical purposes. If the link text is significantly different than the item name, consider using a normal wikilink instead of this template.
An empty value can be specified to avoid displaying a text link entirely; the link will consist of only the item icon. |
large | boolean | If set to true, instead of the small icon in front of the name, a large inventory icon will be shown below the item (suitable for tables). |
image | str or int | This can be used to link against an alternate art version of an item.
Depending on which type is supplied:
|
html | str | HTML to use for the itembox.
May also be used to hide the item box entirely. |
inventory_icon | str | File to use for the inline icon link. |
skip_query | boolean | Skip querying for the item. |
link | str | Which page to link to. This parameter can only be used if skip_query=true .
|
Errors
No pages found
When the search parameters can't find any items for the given parameter, a red error box will be shown. It can be caused by updates to the game that change the name of items, so links to the old name can no longer find the item with the new name.
The solution is to either use a different search parameter or making sure the parameter is correct.
Example:
Broken: {{Item link|item_name_exact=Pierce}}
Module Error: No results found for item using search term "item_name_exact = Pierce"
Fixed: {{Item link|item_name_exact=Pierce Support}}
Module Error: No results found for item using search term "item_name_exact = Pierce Support"
In rare cases, it's also possible it's caused by Database problems causing data to not be written on the target page. In those cases, null editing the target page should help. See Path of Exile Wiki:Known issues for more information.
Too many results found
When the search parameters find to many items, a red error box will be shown because the script doesn't know which one is the desired result. It is generally caused by items that share the same name, but have their own page such as variants of an unique item for example.
The solution is to use the page parameter to point to the page of the desired item.
Example:
Broken: {{Item link|item_name_exact=Two-Stone Ring}}
Module Error: No results found for item using search term "item_name_exact = Two-Stone Ring"
Fixed: {{Item link|page=Two-Stone Ring (ruby and topaz)}}
Module Error: No results found for item using search term "page = Two-Stone Ring (ruby and topaz)"
In rare cases, it's also possible it's caused by Database problems causing duplicate data on the target page. In those cases, null editing the target page should help. See Path of Exile Wiki:Known issues for more information.
Note
In some case, fixing the error requires to pipe the name to reflect the original wording and context such as in the patch notes section:
Broken: {{Item link|Projectiles Weakness }}
Module Error: No results found for item using search term "item_name = Projectiles Weakness"
Fixed: {{Item link|Sniper's Mark|Projectiles Weakness}}
Module Error: No results found for item using search term "item_name = Sniper's Mark"
Examples
Basic Usage
{{Item link |page=Two-Stone Ring (ruby and topaz) }}
Yields:
Module Error: No results found for item using search term "page = Two-Stone Ring (ruby and topaz)"
{{Item link |item_name=Pierce Support }}
Yields:
Module Error: No results found for item using search term "item_name = Pierce Support"
Large icons
{{Item link |item_name=Pierce Support |large=yes }}
Yields:
Module Error: No results found for item using search term "item_name = Pierce Support"