Content deleted Content added
Explaining the "page" parameter. |
m syntaxhighlight lang="wikitext" |
||
(8 intermediate revisions by 8 users not shown) | |||
Line 1:
{{Documentation subpage}}
<!--Categories where indicated at the bottom of this page, please; interwikis at Wikidata (see [[Wikipedia:Wikidata]])-->
{{high-use}}
This is the {{tl|talkspace detect}} meta-template.
It helps other templates detect what type of page they are on.
:'''main''' = Defines the output if the template is located on main/article talkspace; aka ''Talk:''.
:'''user''', '''wikipedia''', '''file''', '''mediawiki''', '''template''', '''help''', '''category''', '''portal''', '''draft''' and '''
:'''default''' = Defines the output if the template is located on any talkspaces that were not defined as a parameter to this meta-template.
:'''other''' = Defines the output if the template is located on any subject space (not the associated talkspace).
This template takes one or more parameters named after the different page types as listed above. Like this:
<syntaxhighlight lang="wikitext">
{{talkspace detect
| main = Article talk page text
Line 22:
| other = Text for all subject spaces
}}
</syntaxhighlight>
By using an empty parameter you can make it so this template doesn't render anything for some specific page type. Like this:
<syntaxhighlight lang="wikitext">
{{talkspace detect
| main =
| default = Text for all other talkspaces
}}
</syntaxhighlight>
=== The "page" parameter ===
For testing and demonstration purposes this template can take a parameter named '''page'''. Like this:
<syntaxhighlight lang="wikitext">
{{talkspace detect
| user = User talk text.
Line 43 ⟶ 42:
| page = User talk:Example
}}
</syntaxhighlight>
No matter on what kind of page the code above is used it will return this:
Line 59 ⟶ 58:
You can make it so your template also understands the '''page''' parameter. That means you can demonstrate the different appearances of your template in the documentation for your template. Then do like this:
<syntaxhighlight lang="wikitext">
{{talkspace detect
| user = User talk text.
Line 65 ⟶ 64:
| page = {{{page|}}}
}}
</syntaxhighlight>
{{Namespace and pagename-detecting templates}}
<includeonly>{{Sandbox other|
| <!--Categories below this line, please; interwikis at Wikidata-->
[[Category:Namespace manipulation templates]]
[[Category:Talk namespace templates]]
[[Category:Wikipedia metatemplates]]
}}</includeonly>▼
▲</includeonly>
|