Template:ShowInstrument: Difference between revisions

From PickiPedia: A knowledge base of bluegrass, old time, and other traditional and public domain music
Jump to navigationJump to search
New inline template: links musician name with instrument icon and tooltip via semantic query (via create-page on MediaWiki MCP Server)
 
Fix: remove stray #show output, only use #vardefine/#var for the icon (via update-page on MediaWiki MCP Server)
Line 7: Line 7:
</pre>
</pre>


Outputs: '''Cory Walker''' 🪕 (with the instrument icon and tooltip)
Outputs: a link to the musician's page, followed by a small instrument icon with tooltip (if they have a primary instrument set).


If the musician has no instrument set, it falls back to a plain link (same as the old {{Musician}} template).
If the musician has no instrument set, it falls back to a plain link (same as the old {{Musician}} template).
Line 14: Line 14:
* [[Template:MusicianInfo]] - Sets the '''Primary instrument''' property
* [[Template:MusicianInfo]] - Sets the '''Primary instrument''' property
* [[Template:ThinkingEntityInfo]] - Shows instrument icon in infobox
* [[Template:ThinkingEntityInfo]] - Shows instrument icon in infobox
</noinclude><includeonly>[[{{{1}}}|{{#rambutanplain:{{{1}}}}}]]{{#show:{{{1}}}|?Primary instrument|link=none|headers=hide|default=}}{{#vardefine:inst|{{#show:{{{1}}}|?Primary instrument|link=none|headers=hide|default=}}}}{{#if:{{#var:inst}}|<span title="{{#var:inst}}">[[File:Instrument-icon-{{#var:inst}}.png|22px|{{#var:inst}}|link=]]</span>}}</includeonly>
</noinclude><includeonly>{{#vardefine:inst|{{#show:{{{1}}}|?Primary instrument|link=none|headers=hide|default=}}}}[[{{{1}}}|{{#rambutanplain:{{{1}}}}}]]{{#if:{{#var:inst}}|&nbsp;<span title="{{#var:inst}}">[[File:Instrument-icon-{{#var:inst}}.png|22px|{{#var:inst}}|link=]]</span>}}</includeonly>

Revision as of 10:00, 30 January 2026

Inline template for linking to a musician with their instrument icon. Queries the musician's Primary instrument semantic property and displays a small icon with a tooltip.

Usage

{{ShowInstrument|Cory Walker}}

Outputs: a link to the musician's page, followed by a small instrument icon with tooltip (if they have a primary instrument set).

If the musician has no instrument set, it falls back to a plain link (same as the old {{#vardefine:inst|}}[[{{{1}}}|{{{1}}}]] [[File:Instrument-icon-{{#var:inst}}.png|22px|{{#var:inst}}|link=]] template).

See also