• Home
  • Random
  • Log in
  • Settings
  • About English Wikipedia @ Freddythechick
English Wikipedia @ Freddythechick

Template:Draft other/sandbox

  • Language
  • Watch
  • View source
< Template:Draft other
__EXPECTUNUSEDTEMPLATE__This is the template sandbox page for Template:Draft other (diff).
Template documentation[view] [edit] [history] [purge]
WarningThis template is used on approximately 96,000 pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them.
Shortcut
  • {{ns118}}

This is the {{draft other}} meta-template.

This template helps other templates detect if they are on a "Draft:" page or some "other" type of page.

Usage

This template usually takes two parameters, like this:

<syntaxhighlight lang="wikitext"> Other pages text </syntaxhighlight>

If the template is on a "Draft:" page, it will return this:

Draft page text

If the template is on any other page, it will return this:

Other pages text

A typical usage case could be to make it so that a template only adds a category when on Draft pages. Thus not adding other pages that just show the template. Like this:

<syntaxhighlight lang="wikitext">

</syntaxhighlight>

Or to warn that a template should not be used on other pages:

<syntaxhighlight lang="wikitext"> This template should only be used on draft pages. </syntaxhighlight>

Note that in the first case above the "other" parameter was not used, and in the second example the "draft" parameter was left empty.

Demospace

For testing and demonstration purposes this template can take a parameter named demospace.

  • If it has the value draft it returns the draft page text.
  • It if has the value other or any other value such as the name of some other namespace it returns the other pages text.
  • If the parameter is empty or undefined, the actual page type determines the result.

Like this:

<syntaxhighlight lang="wikitext"> Draft page text </syntaxhighlight>

No matter on what kind of page the code above is used it will return this:

Draft page text

You can make it so your template also understands the demospace 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"> Other pages text </syntaxhighlight>

Technical details

This template detects "Draft talk:" pages as type other.

This template works like {{main talk other}}, for more examples and technical details see full documentation there.


  • v
  • t
  • e
Namespace and pagename-detecting templates
Namespace
Particular
  • Main other
  • Talk other
  • Category other
  • Draft other
  • File other
    • Is Commons
  • Help other
  • Module other
  • Portal other
  • Template other
  • User other
  • Project other
  • Single namespace
  • If talkspace of
  • If usertalk of
More generic
  • Namespace detect
  • Namespace detect showall
  • Main talk other
    • Main talk other flex
  • Talkspace detect
Pagename
When on basepage
Detects and acts according to whether it is on a basepage or on any subpage (that is, a ../.. subpage).
When pagename is
For pattern matching on the pagename.
Module:Page
Can take apart and put together pagenames in several ways.
IP-talk
Returns IP-user talkpage, registered-user talkpage or non-user talkpage.
IP-user other
For detecting IP-user pages.
Subpage other
Pagename has an after-slash part (not in mainspace)
Sandbox other
Page is subpage /sandbox (template space)
Testcases other
Page is subpage /testcases (template space)
Rootpage other
Page is rootpage (vs. /subpage) (template space)
Others
Stub other
Detects whether it is on a page with a stub template or not.
Redirect other
Detects whether it is on a redirect or not.
If preview
Detects whether page is viewed as a preview or not.
If IP
Displays different content to IP users and logged-in users.
If autoconfirmed
Displays different content to autoconfirmed and non-autoconfirmed users.
If extended confirmed
Displays different content to extended confirmed and non-extended confirmed users.
If administrator
Displays content only to admins.
If mobile
Displays different content to mobile users and desktop users.
If dark
Displays different content to dark mode users and light mode users.
Noscript
Detects whether page is viewed with a JavaScript-capable client or not.
  • Wikipedia:Namespace
  • Wikipedia:Page name
  • Magic words
  • ParserFunctions
The above documentation is transcluded from Template:Draft other/doc. (edit | history)
Editors can experiment in this template's sandbox (edit | diff) and testcases (create) pages.
Add categories to the /doc subpage. Subpages of this template.
Retrieved from "https://enwiki.freddythechick.net/index.php?title=Template:Draft_other/sandbox&oldid=12472282"
Last edited on 19 May 2023, at 16:46

Languages

      This page is not available in other languages.

      English Wikipedia @ Freddythechick
      • This page was last edited on 19 May 2023, at 16:46.
      • Content is available under Creative Commons Attribution-ShareAlike 4.0 unless otherwise noted.
      • About English Wikipedia @ Freddythechick
      • Desktop