Template:Documentation subpage: Difference between revisions
Chalochatu (talk | contribs) No edit summary Tag: Reverted |
Chalochatu (talk | contribs) No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
<includeonly><!-- | <includeonly><!-- | ||
-->{{#ifeq:{{lc:{{SUBPAGENAME}}}}|{{{override|doc}}} | -->{{#ifeq:{{lc:{{SUBPAGENAME}}}} |{{{override|doc}}} | ||
| <!--(this template has been transcluded on a /doc or /{{{override}}} page)--> | |||
</includeonly><!-- | |||
-->{{#ifeq:{{{doc-notice|show}}} |show | |||
| {{Mbox | |||
| type = notice | |||
| style = margin-bottom:1.0em; | |||
| image = [[File:Edit-copy green.svg|40px|alt=|link=]] | |||
| text = | |||
'''This is a [[Chalo Chatu:Template documentation|documentation]] [[Chalo Chatu:Subpages|subpage]] for {{{1|[[:{{SUBJECTSPACE}}:{{BASEPAGENAME}}]]}}}'''.<br />It contains usage information, [[Chalo Chatu: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}}}}}}}}. | |||
}} | |||
}}<!-- | |||
-->{{DEFAULTSORT:{{{defaultsort|{{PAGENAME}}}}}}}<!-- | |||
-->{{#if:{{{inhibit|}}} |<!--(don't categorize)--> | |||
| <includeonly><!-- | |||
-->{{#ifexist:{{NAMESPACE}}:{{BASEPAGENAME}} | |||
| [[Category:{{#switch:{{SUBJECTSPACE}} |Template=Template |Module=Module |User=User |#default=Chalo Chatu}} documentation pages]] | |||
| [[Category:Documentation subpages without corresponding pages]] | |||
}}<!-- | |||
--></includeonly> | |||
}}<!-- | |||
(completing initial #ifeq: at start of template:) | |||
--><includeonly> | |||
| <!--(this template has not been transcluded on a /doc or /{{{override}}} page)--> | |||
}}<!-- | |||
--></includeonly><noinclude>{{Documentation}}</noinclude> | |||
}} | |||
</includeonly><noinclude>{{Documentation}}</noinclude> |
Latest revision as of 14:51, 10 September 2025
It contains usage information, categories and other content that is not part of the original template page.
<templatestyles src="Module:Documentation/styles.css"></templatestyles>
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 |