Template:ARTICLEROOTPAGENAME/doc: Difference between revisions

From Xenharmonic Wiki
Jump to navigation Jump to search
ArrowHead294 (talk | contribs)
m Undid revision 196133 by ArrowHead294 (talk)—it works as intended, reverting
Tag: Undo
ArrowHead294 (talk | contribs)
mNo edit summary
Line 2: Line 2:
<code>ARTICLEROOTPAGENAME</code> is a pseudo-magic word that returns the associated content namespace (e.g. "Template" if used on a page in the "Template" or "Template talk" namespace), followed by the root of the page name in namespaces where automatic subpages are enabled, or the page name without the namespace otherwise. It is equivalent to <code>{{tlx|ARTICLESPACE|plaincode}}:{{tlx|ROOTPAGENAME|plaincode}}</code>, with an additional <code><nowiki>{{</nowiki>[[mw:Help:Extension:ParserFunctions|#if:&nbsp;]]<nowiki>}}</nowiki></code> statement to avoid adding a colon on pages in the main (article) namespace (where it will return {{tlx|PAGENAME}} instead).
<code>ARTICLEROOTPAGENAME</code> is a pseudo-magic word that returns the associated content namespace (e.g. "Template" if used on a page in the "Template" or "Template talk" namespace), followed by the root of the page name in namespaces where automatic subpages are enabled, or the page name without the namespace otherwise. It is equivalent to <code>{{tlx|ARTICLESPACE|plaincode}}:{{tlx|ROOTPAGENAME|plaincode}}</code>, with an additional <code><nowiki>{{</nowiki>[[mw:Help:Extension:ParserFunctions|#if:&nbsp;]]<nowiki>}}</nowiki></code> statement to avoid adding a colon on pages in the main (article) namespace (where it will return {{tlx|PAGENAME}} instead).


=== Examples ===
This template can be [[mw:help:substitution|substituted]] using <code><nowiki>{{subst:ARTICLEROOTPAGENAME}}</nowiki></code>.
 
=== Usage examples ===
{| class="wikitable"
{| class="wikitable"
|-
|-

Revision as of 18:20, 17 May 2025

ARTICLEROOTPAGENAME is a pseudo-magic word that returns the associated content namespace (e.g. "Template" if used on a page in the "Template" or "Template talk" namespace), followed by the root of the page name in namespaces where automatic subpages are enabled, or the page name without the namespace otherwise. It is equivalent to {{ARTICLESPACE}}:{{ROOTPAGENAME}}, with an additional {{#if: }} statement to avoid adding a colon on pages in the main (article) namespace (where it will return {{PAGENAME}} instead).

This template can be substituted using {{subst:ARTICLEROOTPAGENAME}}.

Usage examples

Full page name Output
Template:ABC Template:ABC
Template:ABC/DEF
Template talk:ABC
Template talk:ABC/DEF
ABC ABC
Talk:ABC
ABC/DEF ABC/DEF
Talk:ABC/DEF