Extension:TopicTags/Template-TagDPL

Purpose edit

Returns a list of all pages tagged with the same tag-name.

Create page edit

YOUR-WIKI-URL/Template:TagDPL

Paste edit

<includeonly>{{#dplreplace:{{#dpl: 
     noresultsheader= &nbsp;
     |uses = Template:Tag
     |format = ,\n* [[%PAGE%#Tag:{{{1}}}|%PAGE%]]·,,
     |include = {Tag}:1
     |includematch = /{{{1}}}/
 }}|·.*}}</nowiki><nowiki></includeonly>

Explanation edit

<includeonly>

<!-- the raw DPL will list each page containing the tag, along with the tagname. 
dplreplace removes the tagname from each line, leaving only the page names. 
Details: https://webapps.stackexchange.com/a/117700/151811 -->
{{#dplreplace:
    {{#dpl: 

<!-- ensures no error is returned if list is empty (tag is not found anyplace) --> 
    noresultsheader= &nbsp;
    
<!-- finds all pages that transclude Template:Tag -->
    |uses = Template:Tag
    
<!-- transcludes a link to the tag-anchor in the page where the tag was inserted. 
{{{1}}} is the tag-name passed into this template -->
    |format = ,\n* [[%PAGE%#Tag:{{{1}}}|%PAGE%]]·,,
    
<!-- includes the tag-name in the dpl output. 
That's needed so includematch can filter on the desired tag-name -->
    |include = {Tag}:1
    
<!-- filter in the desired tag-name -->
    |includematch = /{{{1}}}/

<!-- remove the tag-names created by the include statement.
They were only needed so includematch could perform the filter on tag-name -->
}}|·.*}}

</includeonly>