Jump to content

Wikipedia:Template namespace: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
add history, esp. reference to older VfD mechanism
Templates should not masquerade as article-space text; place the text directly into the article.
Line 6: Line 6:
* create navigational boxes and sidebars to link series of related articles together.
* create navigational boxes and sidebars to link series of related articles together.
* provide cross-language portability of texts which are largely internationally the same, but contain some standard terms different in each language; the standard terms are replaced by <nowiki>{{..}}</nowiki> referring to Template pages which have the same name but localised content in each language. This is [[Wikipedia:WikiProject Tree of Life/Taxobox Usage|applied for taxoboxes]].
* provide cross-language portability of texts which are largely internationally the same, but contain some standard terms different in each language; the standard terms are replaced by <nowiki>{{..}}</nowiki> referring to Template pages which have the same name but localised content in each language. This is [[Wikipedia:WikiProject Tree of Life/Taxobox Usage|applied for taxoboxes]].

Templates should not masquerade as article-space text; instead, place the text directly into the article.


For instructions on using this namespace, and for more information about it, please see [[m:Template]].
For instructions on using this namespace, and for more information about it, please see [[m:Template]].

Revision as of 17:35, 15 March 2005

Note: "msg:" can now be dispensed with, use e.g. {{stub}}; also, spaces in the name are now allowed, e.g. {{train topics}}.

With the template namespace it is possible to include the contents of a page in that namespace within a page in a different namespace, using the {{title}} command (this example would import Template:Title). This is used to:

  • place recurring messages (such as those to denote stubs, disambiguation pages, etc.) into articles in a consistent manner;
  • insert boilerplate messages for various issues like copyright violation, neutrality disputes, etc., using a simple shortcut command; and
  • create navigational boxes and sidebars to link series of related articles together.
  • provide cross-language portability of texts which are largely internationally the same, but contain some standard terms different in each language; the standard terms are replaced by {{..}} referring to Template pages which have the same name but localised content in each language. This is applied for taxoboxes.

Templates should not masquerade as article-space text; instead, place the text directly into the article.

For instructions on using this namespace, and for more information about it, please see m:Template. For a list of topical category sidebars in the Template namespace, see Wikipedia:topics.

Instructions (to be updated)

In order to create a new custom message, simply create a page in the Template namespace, named "Template:", followed by a name for the message, that contains the text of the message. Names can now contain spaces and initial case is irrelevant. To create such a page, enter http://wiki.riteme.site/wiki/Template:TheNameOfYourTemplate in the address bar of your browser and edit the page. An alternate method is to create a link something like [[Template:mymessage]] on your user page or in the sandbox and then click on it. You may want to consider protecting the messages you create (if you have administrator privileges), but see the talk page for a discussion of this. Please list any custom messages you create on this page.

There are two major ways to include custom messages, {{Your message}} and {{subst:Your message}}. {{subst:Your message}} makes a copy of the message text and places it where you put the tag after you save an article (substitution). Without "subst", the message will be loaded and put on the page every time you view it, a process known as transclusion.

In other words, when the message is updated, you do not need to update a page that uses it if you use {{Your message}}. As a guideline, short, temporal messages that will be removed soon should be copied using subst (which has the advantage of showing the message in the wiki source), and standard notices that might remain on a page for months or forever should be transcluded for easy updating. (You should not use {{Your message}} for a message which contain any links which may change in the future. This method doesn't refresh "What links here" unless every article containing the {{Your message}} get changed after the modification of the link in the message.)

If you need to edit the template message individually after you put it on your page, use subst. If you don't need to edit it, and would rather the message is automatically updated along with changes made to the template, don't use subst.

For convenient editing of the custom message from a page on which it is used you can include in the custom message a link to edit itself, see e.g. the navigational box at Train.

To experiment, use subpages of your user page (they also work as template, put the full page name in double braces, see m:template), or use Template:Template sandbox.

History

Until June 2004, the MediaWiki namespace was used for creating other boilerplate text messages, to be inserted in articles. This function was replaced with the Template namespace during a software upgrade. As a function of the "Template namespace initialisation script", all non-system messages were moved to the new namespace, and many redirects still exist. The initialisation script also replaced MediaWiki: references in articles with Template: in order to bypass the redirects.

For a short time, Wikipedia:Votes for deletion used MediaWiki: messages named in the format "MediaWiki:VfD-articlename". These were moved to the Template: space in June 2004 and are now named "Template:VfD-articlename". This usage is deprecated now in favor of subpages. A (long) list of these VfD vote pages can be found at Wikipedia:VfD votes in the Template namespace.


Search templates

E.g.

http://wiki.riteme.site/wiki/Special:Search?ns0=0&ns1=0&ns2=0&ns3=0&ns4=0&ns5=0&ns6=0&ns7=0&&ns9=0&ns10=1&ns11=1&ns12=0&ns13=0&ns14=0&ns15=0&searchx=Search&search=regnum

searches the Template and Template talk namespaces for "regnum".

However, this does not work if the search term exists as a pagename in any namespace!