参考自MediaWiki Handbook:[url][/url]
The template namespace is the namespace with prefix “Template:”.

A page in this namespace is called a template. The contents of such a page (either fixed or depending on parameters and/or variables) is designed to be useful for insertion in other pages (transclusion, creating a compound document).

The syntax for insertion of the page “Template:name” is {{name}}. This is called a template tag.

插入模板的标记是{{name}} “Template:name“
This reference in the wikitext causes insertion of the template content when the referring page is rendered. Various equivalent terms are:

calling the template 调用模板
referring to the template 涉及模板
including the template 包含模板
If the page “Template:name” does not exist, then {{name}} works as [[Template:name]], a link to a non-existing page, leading to the edit page. Thus, one way of making a template is putting the tag first, and then following the link.


If name starts with a valid namespace prefix, or a colon, then it is not prefixed with “Template:”. This way any page can be used as template (a colon at the start refers to the main namespace). In the case of an image or category, it gives the description part. Using a page outside the template namespace as template can be useful for:


quoting interface messages in the MediaWiki namespace 提供mediawiki名空间消息接口
experimenting with templates in subpages of one’s userpage 在用户子页面测试模板,“沙盒“
using the description of an image for a caption 把一个图片的描述用作标题

A template only works when referred to from a page in the same project. To use it in another project, one has to copy it to there.

As usual the name is case sensitive except (on most projects) for the first letter, and a blank space is equivalent with an underscore.

Recursive inclusion is possible.

A variable in a template is evaluated after insertion in the referring page, i.e. if {{PAGENAME}} occurs in the wikitext of a template, it is rendered as the name of the referring page, not the name of the template.