<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="nb">
	<id>https://www.wikisida.no/index.php?action=history&amp;feed=atom&amp;title=Mal%3AIf_pagename%2Fdok</id>
	<title>Mal:If pagename/dok - Sideversjonshistorikk</title>
	<link rel="self" type="application/atom+xml" href="https://www.wikisida.no/index.php?action=history&amp;feed=atom&amp;title=Mal%3AIf_pagename%2Fdok"/>
	<link rel="alternate" type="text/html" href="https://www.wikisida.no/index.php?title=Mal:If_pagename/dok&amp;action=history"/>
	<updated>2026-04-15T22:58:30Z</updated>
	<subtitle>Versjonshistorikk for denne siden på wikien</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://www.wikisida.no/index.php?title=Mal:If_pagename/dok&amp;diff=143761&amp;oldid=prev</id>
		<title>Wikisida: Én sideversjon ble importert</title>
		<link rel="alternate" type="text/html" href="https://www.wikisida.no/index.php?title=Mal:If_pagename/dok&amp;diff=143761&amp;oldid=prev"/>
		<updated>2026-04-13T11:33:30Z</updated>

		<summary type="html">&lt;p&gt;Én sideversjon ble importert&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;nb&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Eldre sideversjon&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Sideversjonen fra 13. apr. 2026 kl. 11:33&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;4&quot; class=&quot;diff-notice&quot; lang=&quot;nb&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(Ingen forskjell)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key c1wiki:diff:1.41:old-143760:rev-143761 --&gt;
&lt;/table&gt;</summary>
		<author><name>Wikisida</name></author>
	</entry>
	<entry>
		<id>https://www.wikisida.no/index.php?title=Mal:If_pagename/dok&amp;diff=143760&amp;oldid=prev</id>
		<title>nb&gt;Danmichaelo på 27. nov. 2012 kl. 23:32</title>
		<link rel="alternate" type="text/html" href="https://www.wikisida.no/index.php?title=Mal:If_pagename/dok&amp;diff=143760&amp;oldid=prev"/>
		<updated>2012-11-27T23:32:14Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Ny side&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Documentation subpage}}&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|if pagename}} meta-template.&lt;br /&gt;
&lt;br /&gt;
It helps other templates detect what page they are on. It uses pattern matching on the pagename.&lt;br /&gt;
&lt;br /&gt;
See also the extended version: {{tl|if pagename multi}}. That one can reuse the same input on multiple matching patterns.&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;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{if pagename&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;
&lt;br /&gt;
:{{if pagename&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;
:{{if pagename&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;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{if pagename&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;!-- Default fallbacks --&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;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{if pagename&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;
:{{if pagename&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;
&lt;br /&gt;
:{{if pagename&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;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{if pagename&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;
&lt;br /&gt;
:{{if pagename&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;
=== 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;
{{if pagename&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;
&lt;br /&gt;
:{{if pagename&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;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{if pagename&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|template other}}. Like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{template other&lt;br /&gt;
| {{if pagename&lt;br /&gt;
  | /doc = Template doc page text.&lt;br /&gt;
  }}&lt;br /&gt;
| &amp;lt;!-- Other space, do nothing --&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;
&lt;br /&gt;
:{{template other&lt;br /&gt;
| {{if pagename&lt;br /&gt;
  | /doc = Template doc page text.&lt;br /&gt;
  | page = Template:Example/doc&lt;br /&gt;
  }}&lt;br /&gt;
| &amp;lt;!-- Other space, do nothing --&amp;gt;&lt;br /&gt;
| demospace = template&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 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;
For more technical details see the [[Template talk:If pagename|talk page]].&lt;br /&gt;
&lt;br /&gt;
=== 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;
[[Kategori:Metamaler|{{PAGENAME}}]]&lt;br /&gt;
&lt;br /&gt;
[[en:Template:If pagename]]&lt;br /&gt;
[[sl:Predloga:If pagename]]&lt;br /&gt;
[[tpi:Template:If pagename]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>nb&gt;Danmichaelo</name></author>
	</entry>
</feed>