<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://pool.calebcooper.ie/index.php?action=history&amp;feed=atom&amp;title=Template%3AWhen_pagename_is%2Fdoc</id>
	<title>Template:When pagename is/doc - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://pool.calebcooper.ie/index.php?action=history&amp;feed=atom&amp;title=Template%3AWhen_pagename_is%2Fdoc"/>
	<link rel="alternate" type="text/html" href="https://pool.calebcooper.ie/index.php?title=Template:When_pagename_is/doc&amp;action=history"/>
	<updated>2026-04-08T01:13:12Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://pool.calebcooper.ie/index.php?title=Template:When_pagename_is/doc&amp;diff=13367&amp;oldid=prev</id>
		<title>Caleb Cooper: Text replacement - &quot;[[Template talk&quot; to &quot;[[Wikipedia:Template talk&quot;</title>
		<link rel="alternate" type="text/html" href="https://pool.calebcooper.ie/index.php?title=Template:When_pagename_is/doc&amp;diff=13367&amp;oldid=prev"/>
		<updated>2020-10-21T15:50:57Z</updated>

		<summary type="html">&lt;p&gt;Text replacement - &amp;quot;[[Template talk&amp;quot; to &amp;quot;[[Wikipedia:Template talk&amp;quot;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 15:50, 21 October 2020&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 180:&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 180:&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This template detects subpages even when used in namespaces that don&#039;t have the MediaWiki [[meta:Link#Subpage feature|subpage feature]] enabled. Thus this template works the same in all namespaces.&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This template detects subpages even when used in namespaces that don&#039;t have the MediaWiki [[meta:Link#Subpage feature|subpage feature]] enabled. Thus this template works the same in all namespaces.&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;For more technical details, see the [[Template talk:When pagename is|talk page]].&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;For more technical details, see the [[&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Wikipedia:&lt;/ins&gt;Template talk:When pagename is|talk page]].&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== See also ==&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== See also ==&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Caleb Cooper</name></author>
	</entry>
	<entry>
		<id>https://pool.calebcooper.ie/index.php?title=Template:When_pagename_is/doc&amp;diff=11993&amp;oldid=prev</id>
		<title>Caleb Cooper: Created page with &quot;{{Documentation subpage}}{{Commons Import}}  &lt;!--Categories where indicated at the bottom of this page, please; interwikis at Wikidata (see Wikipedia:Wikidata)--&gt;  This is...&quot;</title>
		<link rel="alternate" type="text/html" href="https://pool.calebcooper.ie/index.php?title=Template:When_pagename_is/doc&amp;diff=11993&amp;oldid=prev"/>
		<updated>2020-10-17T16:55:51Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{Documentation subpage}}{{Commons Import}}  &amp;lt;!--Categories where indicated at the bottom of this page, please; interwikis at Wikidata (see &lt;a href=&quot;https://en.wikipedia.org/wiki/Wikidata&quot; class=&quot;extiw&quot; title=&quot;wikipedia:Wikidata&quot;&gt;Wikipedia:Wikidata&lt;/a&gt;)--&amp;gt;  This is...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Documentation subpage}}{{Commons Import}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--Categories where indicated at the bottom of this page, please; interwikis at Wikidata (see [[Wikipedia:Wikidata]])--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the {{tl|When pagename is}} meta-template. It helps other templates detect what page they are on, using pattern matching on the pagename.&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
This template takes one or more parameters. Most of the parameters don&amp;#039;t have fixed names, instead they are part of the pattern matching. Like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{When pagename is&lt;br /&gt;
| /doc = Doc page text&lt;br /&gt;
| other = Other pages text&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the template is on &amp;quot;Template:Example/doc&amp;quot; the code above will return this:&lt;br /&gt;
: {{When pagename is&lt;br /&gt;
  | /doc = Doc page text&lt;br /&gt;
  | other = Other pages text&lt;br /&gt;
  | page = Template:Example/doc&lt;br /&gt;
 }}&lt;br /&gt;
&lt;br /&gt;
If the template is on any &amp;#039;&amp;#039;other&amp;#039;&amp;#039; page than a /doc page it will return this:&lt;br /&gt;
&lt;br /&gt;
: {{When pagename is&lt;br /&gt;
   | /doc = Doc page text&lt;br /&gt;
   | other = Other pages text&lt;br /&gt;
   | page = Template:Example&lt;br /&gt;
  }}&lt;br /&gt;
&lt;br /&gt;
Here is a description of the full pattern matching:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{When pagename is&lt;br /&gt;
&amp;lt;!-- Match on full pagename --&amp;gt;&lt;br /&gt;
 | User:Example/test = Text for &amp;quot;User:Example/test&amp;quot;.&lt;br /&gt;
 | User:Example = Text for &amp;quot;User:Example&amp;quot;.&lt;br /&gt;
 | User talk:Example = Text for &amp;quot;User talk:Example&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Match on full basepage name, when on a basepage or its subpages --&amp;gt;&lt;br /&gt;
 | User:Example/+ = Matches &amp;quot;User:Example&amp;quot; and &amp;quot;User:Example/test&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Match on pagename, when on a basepage --&amp;gt;&lt;br /&gt;
 | Example = Matches &amp;quot;User:Example&amp;quot;, &amp;quot;User talk:Example&amp;quot;, &amp;quot;Template:Example&amp;quot; &lt;br /&gt;
             and so on, but not &amp;quot;User:Example/something&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Match on full basepage name, when on a subpage --&amp;gt;&lt;br /&gt;
 | User:Example/* = Matches &amp;quot;User:Example/something&amp;quot;, but not &amp;quot;User:Example&amp;quot;.&lt;br /&gt;
 | User talk:Example/* = Matches &amp;quot;User talk:Example/something&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Match on basepage name, when on a subpage --&amp;gt;&lt;br /&gt;
 | Example/* = Matches &amp;quot;User:Example/something&amp;quot; and &amp;quot;User talk:Example/something&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Match on subpage name --&amp;gt;&lt;br /&gt;
 | /something = Any pagename that ends in &amp;quot;/something&amp;quot;.&lt;br /&gt;
 | /doc = Any pagename that ends in &amp;quot;/doc&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Match on partial subpage name (case-insensitive) --&amp;gt;&lt;br /&gt;
 | /some* = Any subpage name beginning with &amp;quot;/some&amp;quot; or &amp;quot;/Some&amp;quot;.&lt;br /&gt;
 | /arch* = Matches &amp;quot;User talk:Example/Archive 1&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Defaults --&amp;gt;&lt;br /&gt;
 | basepage = Text for any basepage.&lt;br /&gt;
 | subpage = Text for any subpage.&lt;br /&gt;
 | other = Text for any page.&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matching goes from top to bottom, and returns the first parameter that matches. &amp;quot;&amp;#039;&amp;#039;Top to bottom&amp;#039;&amp;#039;&amp;quot; means the order shown above, not the order you happen to feed the parameters.&lt;br /&gt;
&lt;br /&gt;
There&amp;#039;s no limit to the number of parameters that you can use, other than what the servers and MediaWiki system can handle. &lt;br /&gt;
&lt;br /&gt;
Most of the matching is case-sensitive. For instance &amp;quot;&amp;lt;code&amp;gt;/test&amp;lt;/code&amp;gt;&amp;quot; matches &amp;quot;User:Example/test&amp;quot; but not &amp;quot;User:Example/Test&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
Matching on partial subpage names such as &amp;quot;&amp;lt;code&amp;gt;/some*&amp;lt;/code&amp;gt;&amp;quot; has some limitations, see [[#Partial subpage names|its own section]] below.&lt;br /&gt;
&lt;br /&gt;
If an empty (but defined) parameter matches, the matching stops and the template returns an empty string. That&amp;#039;s on purpose and can be used like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{When pagename is&lt;br /&gt;
 | /doc =&lt;br /&gt;
 | /sandbox = Sandbox text&lt;br /&gt;
 | other = Other pages text&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The code above will render nothing when on a /doc page. But when on a /sandbox page it will return this: &lt;br /&gt;
&lt;br /&gt;
: {{When pagename is&lt;br /&gt;
   | /doc =&lt;br /&gt;
   | /sandbox = Sandbox text&lt;br /&gt;
   | other = Other pages text&lt;br /&gt;
   | page = Template:Example/sandbox&lt;br /&gt;
  }}&lt;br /&gt;
&lt;br /&gt;
And when on any other page it will return this:&lt;br /&gt;
: {{When pagename is&lt;br /&gt;
   | /doc =&lt;br /&gt;
   | /sandbox = Sandbox text&lt;br /&gt;
   | other = Other pages text&lt;br /&gt;
   | page = Template:Example&lt;br /&gt;
  }}&lt;br /&gt;
&lt;br /&gt;
== Partial subpage names ==&lt;br /&gt;
&lt;br /&gt;
This template can also match on partial subpage names. Like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{When pagename is&lt;br /&gt;
 | /archiv* = Archive page text&lt;br /&gt;
 | other = Other pages text&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If on &amp;quot;User:Example/Archive 1&amp;quot; the code above will return this:&lt;br /&gt;
: {{When pagename is&lt;br /&gt;
   | /archiv* = Archive page text&lt;br /&gt;
   | other = Other pages text&lt;br /&gt;
   | page = User:Example/Archive 1&lt;br /&gt;
  }}&lt;br /&gt;
&lt;br /&gt;
The parameter name &amp;quot;&amp;lt;code&amp;gt;/some*&amp;lt;/code&amp;gt;&amp;quot; must be lower case. But it matches subpage names in both upper and lower case such as &amp;quot;User:Example/SomeThing&amp;quot; and &amp;quot;User:Example/something&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The partial matching only supports matching on 4, 6 and 8 characters. Thus using &amp;quot;&amp;lt;code&amp;gt;/some*&amp;lt;/code&amp;gt;&amp;quot;, &amp;quot;&amp;lt;code&amp;gt;/someth*&amp;lt;/code&amp;gt;&amp;quot; and &amp;quot;&amp;lt;code&amp;gt;/somethin*&amp;lt;/code&amp;gt;&amp;quot; works, but using &amp;quot;&amp;lt;code&amp;gt;/som*&amp;lt;/code&amp;gt;&amp;quot; or &amp;quot;&amp;lt;code&amp;gt;/somet*&amp;lt;/code&amp;gt;&amp;quot; doesn&amp;#039;t work.&lt;br /&gt;
&lt;br /&gt;
Longer patterns match first, thus if both &amp;quot;&amp;lt;code&amp;gt;/somethin*&amp;lt;/code&amp;gt;&amp;quot; and &amp;quot;&amp;lt;code&amp;gt;/some*&amp;lt;/code&amp;gt;&amp;quot; are defined, and the current page is &amp;quot;User:Example/Something&amp;quot;, then the data from &amp;quot;&amp;lt;code&amp;gt;/somethin*&amp;lt;/code&amp;gt;&amp;quot; will be used.&lt;br /&gt;
&lt;br /&gt;
== &amp;quot;page&amp;quot; parameter ==&lt;br /&gt;
&lt;br /&gt;
For testing and demonstration purposes this template can take a parameter named &amp;#039;&amp;#039;&amp;#039;page&amp;#039;&amp;#039;&amp;#039;. Like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{When pagename is&lt;br /&gt;
 | /test = Test pages text&lt;br /&gt;
 | other = Other pages text&lt;br /&gt;
 | page = Template:Example/test&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No matter on what kind of page the code above is used it will return this:&lt;br /&gt;
: {{When pagename is&lt;br /&gt;
   | /test = Test pages text&lt;br /&gt;
   | other = Other pages text&lt;br /&gt;
   | page = Template:Example/test&lt;br /&gt;
  }}&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;page&amp;#039;&amp;#039;&amp;#039; parameter makes this template behave exactly as if on that page. The pagename doesn&amp;#039;t have to be an existing page. &lt;br /&gt;
&lt;br /&gt;
If the &amp;#039;&amp;#039;&amp;#039;page&amp;#039;&amp;#039;&amp;#039; parameter is empty or undefined, the name of the current page determines the result.&lt;br /&gt;
&lt;br /&gt;
You can make it so your template also understands the &amp;#039;&amp;#039;&amp;#039;page&amp;#039;&amp;#039;&amp;#039; parameter. That means you can demonstrate the different appearances of your template in the documentation for your template. Then do like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{When pagename is&lt;br /&gt;
 | /test = Test pages text&lt;br /&gt;
 | other = Other pages text&lt;br /&gt;
 | page = {{{page|}}}&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Namespace matching ==&lt;br /&gt;
&lt;br /&gt;
This template doesn&amp;#039;t have namespace matching. If you need that then combine this template with one of the namespace-detection templates such as {{tl|When on template page}}. Like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{When on template page&lt;br /&gt;
 | {{When pagename is&lt;br /&gt;
    | /doc = Template doc page text.&lt;br /&gt;
   }}&lt;br /&gt;
 | &amp;lt;!--(action if not on a Template: page)--&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If on &amp;quot;User:Example/doc&amp;quot; the code above will return nothing. But if on &amp;quot;Template:Example/doc&amp;quot; it will return this:&lt;br /&gt;
: {{When on template page |demospace=template&lt;br /&gt;
   | {{When pagename is&lt;br /&gt;
      | /doc = Template doc page text.&lt;br /&gt;
      | page = Template:Example/doc&lt;br /&gt;
     }}&lt;br /&gt;
  | &amp;lt;!--(action if not on a Template: page)--&amp;gt;&lt;br /&gt;
 }}&lt;br /&gt;
&lt;br /&gt;
== Technical details ==&lt;br /&gt;
&lt;br /&gt;
This template detects subpages even when used in namespaces that don&amp;#039;t have the MediaWiki [[meta:Link#Subpage feature|subpage feature]] enabled. Thus this template works the same in all namespaces.&lt;br /&gt;
&lt;br /&gt;
For more technical details, see the [[Template talk:When pagename is|talk page]].&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
{{Namespace and pagename-detecting templates}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;includeonly&amp;gt;{{Sandbox other|&lt;br /&gt;
| &amp;lt;!--Categories below this line, please; interwikis at Wikidata--&amp;gt;&lt;br /&gt;
[[Category:If-then-else templates]]&lt;br /&gt;
[[Category:Pagename manipulation templates]]&lt;br /&gt;
[[Category:Wikipedia metatemplates]]&lt;br /&gt;
}}&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>Caleb Cooper</name></author>
	</entry>
</feed>