<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://sapph.group/wiki/index.php?action=history&amp;feed=atom&amp;title=Template%3ABasepage_subpage%2Fdoc</id>
	<title>Template:Basepage subpage/doc - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://sapph.group/wiki/index.php?action=history&amp;feed=atom&amp;title=Template%3ABasepage_subpage%2Fdoc"/>
	<link rel="alternate" type="text/html" href="https://sapph.group/wiki/index.php?title=Template:Basepage_subpage/doc&amp;action=history"/>
	<updated>2026-05-17T22:38:07Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>https://sapph.group/wiki/index.php?title=Template:Basepage_subpage/doc&amp;diff=3686&amp;oldid=prev</id>
		<title>Bryan: 1 revision</title>
		<link rel="alternate" type="text/html" href="https://sapph.group/wiki/index.php?title=Template:Basepage_subpage/doc&amp;diff=3686&amp;oldid=prev"/>
		<updated>2013-09-03T22:34:12Z</updated>

		<summary type="html">&lt;p&gt;1 revision&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{documentation subpage}}&lt;br /&gt;
{{high-risk| 410,000+ }}&lt;br /&gt;
&amp;lt;!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the {{tl|basepage subpage}} meta-template.&lt;br /&gt;
&lt;br /&gt;
This template helps other templates detect if they are on a &amp;#039;&amp;#039;&amp;#039;basepage&amp;#039;&amp;#039;&amp;#039;, &amp;#039;&amp;#039;&amp;#039;subpage&amp;#039;&amp;#039;&amp;#039; or &amp;#039;&amp;#039;&amp;#039;subsubpage&amp;#039;&amp;#039;&amp;#039;. However, a subpage can be detected without using another template, by instead using a single &amp;lt;code&amp;gt;#ifeq&amp;lt;/code&amp;gt; with parser function &amp;lt;code&amp;gt;#titleparts&amp;lt;/code&amp;gt; (see below: [[#Alternatives for simpler text|Alternatives for simpler text]]).&lt;br /&gt;
&lt;br /&gt;
=== Usage ===&lt;br /&gt;
&lt;br /&gt;
This template takes one or more parameters, like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{basepage subpage&lt;br /&gt;
| Basepage text&lt;br /&gt;
| Subpage text&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the template is on the page &amp;quot;User:Example&amp;quot;, it shall return this:&lt;br /&gt;
&lt;br /&gt;
:{{basepage subpage&lt;br /&gt;
| Basepage text&lt;br /&gt;
| Subpage text&lt;br /&gt;
| page = User:Example&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
If the template is on &amp;quot;User:Example/test&amp;quot; or &amp;quot;User:Example/test/test&amp;quot; or any page lower than that, it will return this:&lt;br /&gt;
&lt;br /&gt;
:{{basepage subpage&lt;br /&gt;
| Basepage text&lt;br /&gt;
| Subpage text&lt;br /&gt;
| page = User:Example/test/test&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
This template can also detect &amp;quot;subsubpages&amp;quot;, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{basepage subpage&lt;br /&gt;
| Basepage text&lt;br /&gt;
| Subpage text&lt;br /&gt;
| Subsubpage 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;User:Example/test/test&amp;quot; or any page lower than that, it will return this:&lt;br /&gt;
&lt;br /&gt;
:{{basepage subpage&lt;br /&gt;
| Basepage text&lt;br /&gt;
| Subpage text&lt;br /&gt;
| Subsubpage text&lt;br /&gt;
| page = User:Example/test/test&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
By using an empty parameter you can make it so the template doesn&amp;#039;t render anything for some specific page type. Like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{basepage subpage&lt;br /&gt;
| Basepage text&lt;br /&gt;
| Subpage text&lt;br /&gt;
| &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 &amp;quot;User:Example/test/test&amp;quot; or lower, but will return this when on &amp;quot;User:Example/test&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
:{{basepage subpage&lt;br /&gt;
| Basepage text&lt;br /&gt;
| Subpage text&lt;br /&gt;
| &lt;br /&gt;
| page = User:Example/test&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== The &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;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{basepage subpage&lt;br /&gt;
| Basepage text&lt;br /&gt;
| Subpage text&lt;br /&gt;
| page = User: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;
&lt;br /&gt;
:{{basepage subpage&lt;br /&gt;
| Basepage text&lt;br /&gt;
| Subpage text&lt;br /&gt;
| page = User: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. Thus, if a subsubpagename like &amp;quot;User:Example/test/test&amp;quot; is fed, then it returns the subsubpage text if there is one, otherwise it returns the subpage text. &lt;br /&gt;
&lt;br /&gt;
The pagename doesn&amp;#039;t have to be an existing page. &lt;br /&gt;
&lt;br /&gt;
If the 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;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{basepage subpage&lt;br /&gt;
| Basepage text&lt;br /&gt;
| Subpage text&lt;br /&gt;
| page = {{{page|}}}&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Technical details ===&lt;br /&gt;
&lt;br /&gt;
Templates have a problem to handle parameter data that contains equal signs &amp;quot;&amp;lt;code&amp;gt;=&amp;lt;/code&amp;gt;&amp;quot;. But that is easily solved by using numbered parameters. Like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{basepage subpage&lt;br /&gt;
| 1 = Basepage text&lt;br /&gt;
| 2 = Subpage text&lt;br /&gt;
| 3 = Subsubpage text&lt;br /&gt;
| page = {{{page|}}}&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This template detects subpages even when used in namespaces that doesn&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;
=== Alternatives for simpler text ===&lt;br /&gt;
A subpage can be detected without using another template, by instead using a single &amp;lt;code&amp;gt;#ifeq&amp;lt;/code&amp;gt; along with the title-splitting parser function &amp;lt;code&amp;gt;#titleparts&amp;lt;/code&amp;gt;, with expansion depth +1, as follows:&lt;br /&gt;
::: &amp;lt;nowiki&amp;gt;{{#ifeq: {{#titleparts:{{PAGENAME}}|1|1}} | {{PAGENAME}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:::: &amp;lt;nowiki&amp;gt; | ...then on base page...&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:::: &amp;lt;nowiki&amp;gt; | ...else on a subpage...&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
::: &amp;lt;nowiki&amp;gt;}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
For example, many templates can check if the page is a /sandbox version, by the similar markup with &amp;lt;code&amp;gt;#ifeq&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;#titleparts&amp;lt;/code&amp;gt;:&lt;br /&gt;
::: &amp;lt;nowiki&amp;gt;{{#ifeq: {{#titleparts:{{PAGENAME}}|1|1}} | {{PAGENAME}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:::: &amp;lt;nowiki&amp;gt; | {{documentation}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:::: &amp;lt;nowiki&amp;gt; | {{template sandbox notice}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
::: &amp;lt;nowiki&amp;gt;}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
That simple logic works because [[Template:Template_sandbox_notice]] also checks the page name for &amp;quot;/sandbox&amp;quot; before displaying the sandbox notice; otherwise, any other subpage would show no extra text. By avoiding a template, and using a single &amp;lt;code&amp;gt;#ifeq&amp;lt;/code&amp;gt;, then the processing uses only +2 expansion depth levels, rather than +7 levels, and avoids &amp;quot;[[wp:exceeded template limits]]&amp;quot; inside a complex /doc page.&lt;br /&gt;
&lt;br /&gt;
=== See also ===&lt;br /&gt;
&lt;br /&gt;
{{pagename detect see also}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;includeonly&amp;gt;&lt;br /&gt;
&amp;lt;!-- CATEGORIES AND INTERWIKIS HERE, THANKS --&amp;gt;&lt;br /&gt;
[[Category:Wikipedia metatemplates]]&lt;br /&gt;
&lt;br /&gt;
[[as:Template:Basepage subpage]]&lt;br /&gt;
[[bn:টেমপ্লেট:Basepage subpage]]&lt;br /&gt;
[[sl:Predloga:Osnovnastran podstran]]&lt;br /&gt;
&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>Bryan</name></author>
	</entry>
</feed>