Template:Documentation subpage: Difference between revisions
m 1 revision imported |
Chalochatu (talk | contribs) No edit summary Tag: Reverted |
||
Line 1: | Line 1: | ||
<includeonly><!-- | <includeonly><!-- | ||
-->{{#ifeq:{{lc:{{SUBPAGENAME}}}} |{{{override|doc}}} | -->{{#ifeq:{{lc:{{SUBPAGENAME}}}}|{{{override|doc}}} | ||
| <!-- (we are on /doc or /{{{override}}}) --> | |||
{{#ifeq:{{{doc-notice|show}}}|show | |||
| {{#ifexist:Template:Mbox | |||
| {{Mbox | |||
| type = notice | |||
| style = margin-bottom:1.0em; | |||
| image = [[File:Edit-copy green.svg|40px|alt=|link=]] | |||
| text = '''This is a [[{{ns:Project}}:Template documentation|documentation]] [[{{ns:Project}}:Subpages|subpage]] for {{{1|[[:{{SUBJECTSPACE}}:{{BASEPAGENAME}}]]}}}.'''<br /> | |||
It contains usage information, [[{{ns:Project}}:Categorization|categories]] and other content that is not part of the original | |||
'''This is a [[ | {{#if:{{{text2|}}}|{{{text2}}}|{{#if:{{{text1|}}}|{{{text1}}}|{{#ifeq:{{SUBJECTSPACE}}|{{ns:User}}|{{lc:{{SUBJECTSPACE}}}} template page|{{#if:{{SUBJECTSPACE}}|{{lc:{{SUBJECTSPACE}}}} page|article}}}}}}}. | ||
}} | |||
}} | | <!-- Fallback notice if {{Mbox}} is missing --> | ||
<div style="border:1px solid #a2a9b1;background:#f8f9fa;margin:0 0 1.0em 0;padding:.6em;"> | |||
[[File:Edit-copy green.svg|40px|left|alt=]] | |||
<div style="margin-left:48px;"> | |||
<b>This is a [[{{ns:Project}}:Template documentation|documentation]] [[{{ns:Project}}:Subpages|subpage]] for {{{1|[[:{{SUBJECTSPACE}}:{{BASEPAGENAME}}]]}}}.</b><br /> | |||
It contains usage information, [[{{ns:Project}}:Categorization|categories]] and other content that is not part of the original | |||
{{#if:{{{text2|}}}|{{{text2}}}|{{#if:{{{text1|}}}|{{{text1}}}|{{#ifeq:{{SUBJECTSPACE}}|{{ns:User}}|{{lc:{{SUBJECTSPACE}}}} template page|{{#if:{{SUBJECTSPACE}}|{{lc:{{SUBJECTSPACE}}}} page|article}}}}}}}. | |||
</div> | |||
<div style="clear:both;"></div> | |||
</div> | |||
}} | |||
}} | |||
{{DEFAULTSORT:{{{defaultsort|{{PAGENAME}}}}}}} | |||
{{#if:{{{inhibit|}}}| | |||
<!-- (don’t categorize) --> | |||
| | |||
{{#ifexist:{{NAMESPACE}}:{{BASEPAGENAME}} | |||
| [[Category:{{#switch:{{SUBJECTSPACE}}|Template=Template|Module=Module|User=User|#default={{SITENAME}}}} documentation pages]] | |||
| [[Category:Documentation subpages without corresponding pages]] | |||
}} | |||
}} | |||
| <!-- (we are NOT on /doc or /{{{override}}}) --> | |||
}} | |||
</includeonly><noinclude>{{Documentation}}</noinclude> |
Revision as of 14:19, 10 September 2025
<templatestyles src="Module:Documentation/styles.css"></templatestyles>
{{#ifeq:documentation subpage|doc
| {{#ifeq:show|show|
It contains usage information, categories and other content that is not part of the originaltemplate page}.
This template standardizes the header and categorization for documentation subpages (usually “/doc”) on Chalo Chatu, Zambia online encyclopedia. It:
- Shows a documentation notice with a link to the parent page.
- Adds a DEFAULTSORT key.
- Categorizes the doc subpage (or flags it if the parent page does not exist).
- Hides itself when not on the expected subpage (e.g., if transcluded on the main template page by mistake).
It uses {{Mbox}} for the notice if available; otherwise it falls back to a plain styled box.
Usage
Place at the very top of a documentation subpage:
{{Documentation subpage}}
If the parent is non-standard or you want to override the link text:
{{Documentation subpage|1=[[:Template:Example]]}}
If your docs live on a different subpage name (e.g., “/guide”), set override
:
{{Documentation subpage|override=guide}}
Parameters
1
- Optional. Link to the parent page shown in the notice. Defaults to
Template:Documentation subpage
. override
- Optional. Subpage name that should be considered “the documentation page”. Defaults to
doc
. Example:override=sandbox
. doc-notice
- Optional. Set to
show
(default) to display the notice; any other value hides it. text1
,text2
- Optional. Custom trailing text in the notice. If
text2
is set it takes precedence; otherwisetext1
. If neither is set, the template auto-describes the parent as a user/template/article page. defaultsort
- Optional. Value for
Warning: Default sort key "…" overrides earlier default sort key "Documentation subpage".
. Defaults toDocumentation subpage
. inhibit
- Optional. Any non-empty value suppresses categorization (useful for test or draft docs).
Behavior
- Only outputs the notice and categories when transcluded on
/doc
. - When
doc-notice=show
and {{Mbox}} exists, a standard message box is shown; if {{Mbox}} is absent, a plain fallback box is rendered. - Categorizes into a project-appropriate “documentation pages” category if the parent exists; otherwise into a tracking category for docs without a corresponding parent.
Examples
Basic:
<!-- Template:Example/doc --> {{Documentation subpage}} == Purpose == Explain the template here…
Custom parent link:
{{Documentation subpage|1=[[:Template:Infobox person]]}}
Custom subpage name:
{{Documentation subpage|override=guide}}
Suppress categories (e.g., in a user sandbox):
{{Documentation subpage|inhibit=1}}
See also
- {{Documentation}} – a wrapper often placed on the main template page to transclude this “/doc” subpage.
- {{Mbox}} – optional, enhances the notice styling if installed.
TemplateData
Adds a standardized notice, defaultsort, and categories for documentation subpages (typically “/doc”). Hides itself when not on the expected subpage. Uses Mbox if available; otherwise falls back to plain styling.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Parent link | 1 | Custom link to the parent page shown in the notice. Defaults to [[:{{SUBJECTSPACE}}:{{BASEPAGENAME}}]]. | String | optional |
Override subpage name | override | Treat a different subpage name as the documentation page instead of 'doc' (e.g., 'guide', 'manual'). | String | optional |
Show notice | doc-notice | Set to 'show' (default) to display the documentation notice; any other value hides it.
| String | optional |
Custom trailing text | text1 | Custom trailing text in the notice (used if text2 is not provided). | String | optional |
Custom trailing text (priority) | text2 | Custom trailing text in the notice; takes precedence over text1 when provided. | String | optional |
Default sort key | defaultsort | Value for DEFAULTSORT; defaults to the page name. | String | optional |
Suppress categories | inhibit | Set to any non-empty value to prevent this doc page from being categorized. | String | optional |