ππ°πΏππ°πΌπ΄π»π΄πΉπ½π:Template sandbox notice/doc
This is a documentation subpage for ππ°πΏππ°πΌπ΄π»π΄πΉπ½π:Template sandbox notice. It contains usage information, categories and other content that is not part of the original ππ°πΏππ°πΌπ΄π»π΄πΉπ½π page. |
This page is not a sandbox and should not be used for test editing. To experiment, please do so on en:Wikipedia:Sandbox. |
This is the {{Template sandbox notice}}
template.
It can be placed on template /sandbox pages. It also detects when it is not on a /sandbox page and then shows nothing, thus it can be left in the code when copied and pasted to the main template. (Although most users remove the sandbox notice when they copy the code from the /sandbox to the main template. But beware, if the notice-not-sandbox parameter has been used then the sandbox notice must be copied with the rest of the template code. See more below.)
To learn more about how to use template /sandbox and /testcases subpages see en:Wikipedia:Template sandbox and test cases.
Simple example
πΉπ½πΌπ°πΉπ³π΄πΉ<!-- Template code --><noinclude> {{Template sandbox notice}} </noinclude>
Note! The template code must start directly before and physically touch the <noinclude>
tag. Any blank space or newlines between the template code and the <noinclude>
tag can cause the template to render unwanted spaces or newlines when used.
Non-standard "/sandbox" and "/testcases" names
πΉπ½πΌπ°πΉπ³π΄πΉThis template uses case-insensitive matching, so will match "/Sandbox", "/SandBox", "/sAnDbOx" etc. without any special help.
If the /sandbox page has another name, for instance "/sandbag", then you need to tell the sandbox notice the name of the page, so that it knows when to show and when not to show itself. Like this:
<!-- Template code --><noinclude> {{Template sandbox notice|subpage-name=sandbag}} </noinclude>
If the testcases page has another name, this may be specified using the testcases-name parameter:
<!-- Template code --><noinclude> {{Template sandbox notice|testcases-name=testbox}} </noinclude>
Provided there is only one sandbox or testcases page in use for the particular main page, another option is to move the sandbox page to the standard "/sandbox" name, or testcases to "/testcases". That may be preferable since other templates and tools also assume that the sandbox uses that name, such as {{documentation}}
.
Showing and hiding other things
πΉπ½πΌπ°πΉπ³π΄πΉThe sandbox notice can also help showing and hiding other things depending on if it detects it is on the /sandbox page or not. Like this:
<!-- Template code --><noinclude> {{Template sandbox notice | notice-for-sandbox = Text that shows on the /sandbox page. | notice-not-sandbox = Text that will show on other pages. }} <!-- Text for all pages goes here --> </noinclude>
Protection template example
πΉπ½πΌπ°πΉπ³π΄πΉThe notice-not-sandbox parameter can for instance be used so a protection template can be placed already in the /sandbox version of the code. (See also Wikipedia:Protection policy.) Like this:
<!-- Template code --><noinclude> {{Template sandbox notice | notice-not-sandbox = {{Pp-semi-template|small=yes}} }}</noinclude>
Documentation example
πΉπ½πΌπ°πΉπ³π΄πΉSome templates have their documentation on a separate /doc page, and then show that documentation in a green doc box below the template code by using the {{documentation}}
template. (See also Wikipedia:Template documentation.) Then place the sandbox notice like this:
<!-- Template code --><noinclude> {{Template sandbox notice}} {{Documentation}} <!-- Please add this template's categories to the /doc subpage - thanks! --> </noinclude>
Super deluxe example
πΉπ½πΌπ°πΉπ³π΄πΉThis example handles both a protection template and a green doc box from a /doc page at the same time. (See also Wikipedia:Protection policy and Wikipedia:Template documentation.) Like this:
<!-- Template code --><noinclude> {{Template sandbox notice | notice-for-sandbox = Text that shows on the /sandbox page. | notice-not-sandbox = {{Pp-semi-template|small=yes}} }} {{Documentation}} <!-- Please add this template's categories to the /doc subpage - thanks! --> </noinclude>
Copy, paste & delete
πΉπ½πΌπ°πΉπ³π΄πΉThe following "complete" example can be used to copy and paste into your template, then delete the parts you don't need:
<!-- Template code --><noinclude> {{Template sandbox notice | notice-for-sandbox = Text that shows on the /sandbox page. | notice-not-sandbox = <!-- Choose one of the templates below --> <!-- Protection templates as big message boxes --> {{Pp-dispute}} {{Pp-office}} {{Pp-move}} {{Pp-protected}} {{Pp-template}} {{Pp-usertalk}} {{Pp-vandalism}} {{Pp-semi-protected}} {{Pp-semi-sock}} {{Pp-semi-spambot}} {{Pp-semi-template}} {{Pp-semi-usertalk}} {{Pp-semi-vandalism}} <!-- Protection templates as small icons --> {{Pp-dispute|small=yes}} {{Pp-office|small=yes}} {{Pp-move|small=yes}} {{Pp-protected|small=yes}} {{Pp-template|small=yes}} {{Pp-usertalk|small=yes}} {{Pp-vandalism|small=yes}} {{Pp-semi-protected|small=yes}} {{Pp-semi-sock|small=yes}} {{Pp-semi-spambot|small=yes}} {{Pp-semi-template|small=yes}} {{Pp-semi-usertalk|small=yes}} {{Pp-semi-vandalism|small=yes}} <!-- End protection templates, stop deleting, keep next line --> }} <!-- Text for all pages goes here --> {{Documentation}} <!-- Please add this template's categories to the /doc subpage - thanks! --> </noinclude>
Technical details
πΉπ½πΌπ°πΉπ³π΄πΉIf there is an accompanying "/testcases" page this template will detect that and show a link to the /testcases page.
This template categorises /sandbox pages into Category:Template sandboxes. If you don't want a page to be categorised then use the template like this:
{{Template sandbox notice|category=}}
If you want to demonstrate the template on say en:Wikipedia:Template messages/Template namespace then you need to feed the subpage-name to make it show and feed an empty category parameter so it doesn't categorise the page. Like this:
{{Template sandbox notice|subpage-name=Template namespace|category=}}
See also
πΉπ½πΌπ°πΉπ³π΄πΉ{{Template test cases notice}}
β To put on top of /testcases pages.- en:Wikipedia:Template messages/Template namespace β Lists and shows most template related message boxes.