Extension:TopicTags/Template-Tag

From mediawiki.org

This is a hidden template, which transcludes formatted, linked tagname and related-page-list to the transclusion host page.

To install this page:[edit]

1. Browse to the link below on your wiki, to create a new page on your wiki:

YOUR-WIKI-URL/Template:Tag

2. Copy and paste the wikitext below into the source-editor of the new page, and save the page:

<noinclude> __NOCACHE__ </noinclude><includeonly>{{#if: {{{2}}}|{{Span|tag-label|Tag:{{{1}}}}} <small><sup>{{TagLink|{{{1}}}}}</sup></small> </span>{{Span|tag-region}}|'''Also tagged: {{TagLink|{{{1}}}}}'''{{TagDPL|{{{1}}}}}}}</includeonly>

Explanation:[edit]

(note: code below might not be up-to-date. Install only code above.)

The template receives 2 parameters: {{{1}}} is the tag-name. {{{2}}} is the trailing pipe.

<noinclude> __NOCACHE__ </noinclude>

<includeonly>

<!-- if 2nd pipe is missing -->
{{#if: {{{2}}}

<!-- then show superscript tagname with hover-behavior

<!-- open span, passing "tag-label" and tagname as parameters. {{Span}} will use "tag-label" as class (for CSS), and tagname as ID (for anchor). This span encompasses everything from label to end of tagged region. That's needed so that the label will be a parent element to the tagged region. That's needed for CSS-hover to work. -->
{{Span|tag-label|Tag:{{{1}}}}}

<!-- show small, superscript tagname, linked to tag-page, -->
<small><sup>{{TagLink|{{{1}}}}}</sup></small>

<!-- begin tagged-region, passing "tag-region" for class-CSS. Editor must close all spans at the end of tagged region with {{EndTag}} -->
{{Span|tag-region}}

<!-- else (2nd pipe exists), display fullsize tagname -->
|'''Also tagged {{TagLink|{{{1}}}}}'''

<!-- + list of same-tagged pages. -->
{{TagDPL|{{{1}}}}}}}

</includeonly>