Ad placeholder

Template:Main namespace only: Difference between revisions

Jump to navigation Jump to search
m
note the transclusion
m (Sky moved page Template:Main only to Template:Main namespace only: Make the verbose name canonical)
m (note the transclusion)
 
Line 6: Line 6:
The template functions by fetching the <code><nowiki>{{NAMESPACE}}</nowiki></code> [https://www.mediawiki.org/wiki/Help:Magic_words#Namespaces magic word]. NAMESPACE is an empty string for the Main namespace, and the name of the namespace otherwise (e.g. File:, Category:...). Simply checking whether NAMESPACE exists is therefore sufficient to detect whether the page is in the main namespace. Additionally, magic words are evaluated in the final page they are transcluded into.
The template functions by fetching the <code><nowiki>{{NAMESPACE}}</nowiki></code> [https://www.mediawiki.org/wiki/Help:Magic_words#Namespaces magic word]. NAMESPACE is an empty string for the Main namespace, and the name of the namespace otherwise (e.g. File:, Category:...). Simply checking whether NAMESPACE exists is therefore sufficient to detect whether the page is in the main namespace. Additionally, magic words are evaluated in the final page they are transcluded into.


 
For convenience, [[Template:Main only]] points to this template.


<templatedata>
<templatedata>

Navigation menu