Editing Template:When pagename is/doc

From Guild of Archivists
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 3: Line 3:


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.
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.
For an extended version able to reuse the same input on multiple matching patterns, see {{tl|When on page}}.


== Usage ==
== Usage ==
Line 156: Line 158:
== Namespace matching ==
== Namespace matching ==


This template doesn't have namespace matching.
This template doesn'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:
<pre>
{{When on template page
| {{When pagename is
    | /doc = Template doc page text.
  }}
| <!--(action if not on a Template: page)-->
}}
</pre>
 
If on "User:Example/doc" the code above will return nothing. But if on "Template:Example/doc" it will return this:
: {{When on template page |demospace=template
  | {{When pagename is
      | /doc = Template doc page text.
      | page = Template:Example/doc
    }}
  | <!--(action if not on a Template: page)-->
}}


== Technical details ==
== Technical details ==


This template detects subpages even when used in namespaces that don't have the MediaWiki subpage feature enabled. Thus this template works the same in all namespaces.
This template detects subpages even when used in namespaces that don't have the MediaWiki [[meta:Link#Subpage feature|subpage feature]] enabled. Thus this template works the same in all namespaces.
 
For more technical details, see the [[Template talk:When pagename is|talk page]].
 
== See also ==
{{Namespace and pagename-detecting templates}}


<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox |
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox |
Line 166: Line 190:
[[Category:If-then-else templates]]
[[Category:If-then-else templates]]
[[Category:Namespace manipulation templates]]
[[Category:Namespace manipulation templates]]
[[Category:Wikipedia metatemplates]]
}}</includeonly>
}}</includeonly>
Please note that all contributions to Guild of Archivists may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see GoArch:Copyrights for details). Do not submit copyrighted work without permission!
Cancel Editing help (opens in new window)