User:DavidJCobb/Template Sandbox/What Links Here experiment
It's possible, for any template, figure out what pages are calling it with certain parameters. For example, if I want to get a list of pages that are using a template ExampleTemplate
with an unnamed parameter of Foobar
, I can do this:
- Modify
ExampleTemplate
so that it transcludes (calls) the (non-existent) templateExampleTemplate/Test:{{{1}}}
(use the code{{ExampleTemplate/Text:{{{1}}}}}</code)
- Go to the non-existent template <code>ExampleTemplate/Test:Foobar
- Check "What links here" for that non-existent template
ExampleTemplate
and all pages that call ExampleTemplate
with the first unnamed parameter set to Foobar
will be listed.
Demonstration
Link Origin calls the Link Target template with the first unnamed parameter set to Test
. Link Target calls Link End. As a result, Link Target and Link Origin show up in Link End's What links here entry.
The demonstration can go even further. Link End doesn't even need to exist -- Link Target can just call a (non-existent) subpage of itself, like this: {{/Call:{{{1|}}}}}
, and then we could check the What links here entry for any given subpage we want; e.x. we could check /Link Target/Call:Foobar to get a list of pages that call Link Target with the first unnamed paramter being set to Foobar
.
Limits
- The What links here page will also show whatever template is using this trick. E.x. Link End's What links here entry shows Link Target.
- You have to use an article. Using an anchor/header (e.x.
{{Link End#{{{1|}}}}}
) won't work because you can't check What links here on individual sections/headers/anchors of a page.
Other subpages
- Actual Example - This example actually calls a non-existent subpage of itself, based on the first unnamed parameter you give it. I'm using this to test another WIP template.