跳到导航 跳到搜索
MediaWiki手册:内容读者编辑者管理人员系统管理员研究员 +/-



在页面中插入一个模板可以用 {{名字}}插入"Template:名字"。

如果"Template:名字"不存在,{{名字}}将显示为[[Template:名字]], 相当于一个不存在的链接,并且可以编辑它。




在页面中插入模板的话,使用{{{模板名}}}形式。例如{{tc}}[1]。页面Template:Tc的内容被放置到了第二个页面中。如果该页面不存在,则会显示一个红链(red link),例如模板:Tc,鼠标悬停会显示“模板:Tc(页面不存在)”[2]

模板命名空间 模板的命名空间是以“Template:”为前缀的页面命名空间[3]。例如:Template:Tc。该例中的命名空间就是“模板”。该页面的名称为“Template:Tc”[4]



Template loop detected(检测到模板循环):

另请参阅:页面重复。 页面中嵌入的页面列表 (如templatelinks表中所记录) 与所有页面链接, 都在编辑页面的底部。 注意:

  • 在页面编辑时, 模板列表将不会初始显示;而在按下“显示预览”后, 只有该部分中使用的模板才会列出;在预览页面状态下, 再次按 "预览" 将更新所做编辑的列表 (如果有的话);
  • 编辑页面的旧版本时,首先给出该页面当前版本的列表;在按下预览后, 列表将只显示旧版本中使用的模板;再次按下预览将更新在当前会话中旧版本的编辑列表 (如果有的话);
  • 如果嵌入页的名称是表达式, 则显示当前模板名称。例如:


在模板名称中, 字符“#”和其后面的任何字符都会被忽略:{{tc}} 得到的是 {{{{{1}}}}}, {{tc#abc}} 得到的是 {{{{{1}}}}}


如果是用来替代讨论页的模板,则不能被放入讨论命名空间中,因为没有页面能够区分清楚。通常的做法就是将其放入模板命名空间,例如,w:Wikipedia:Talk page templates page templatesw:Wikipedia:Template messages/User talk namespace messages/User talk namespace。用户讨论页的个人辅助模板最好是放在用户页面的子页面中, 而不是用户讨论页中的某页,例如,用"User:Abc/Talk intro"而不是"User talk:Abc/Intro"。


作为用于模板的页面的名称,无论是否在模板命名空间中,常规规则都适用,请参阅Help:Page name。因此,对于模板命名空间中的模板, "模板:"之后的名称部分区分大小写, 但第一个字母的大小写 (同样适用于大多数维基上) 除外, 空白与下划线 "_" 等同。Case sensitivity can be resolved through the use of redirects. E.g., A template is named "AdminAbbr"; if a redirect to the template is created, and named "Adminabbr", the template can then be called with either {{AdminAbbr}} or {{adminabbr}}. Assuming the template name or redirect is all in lowercase (or uppercase), if an editor wished to use a mix of uppercase and lowercase on a template name for clarity, they could then use the lc or uc parser functions, e.g., a template named "CURRENTINTERNETTIME" may be difficult to read for some editors, so rather than using {{CURRENTINTERNETTIME}} the editor could instead use {{ {{uc:CurrentInternetTime}} }}.

但是,参数名称区分大小写,包括第一个字母和不同于下划线的空格。 However, parameter names are case-sensitive, including the first letter, and spaces are different from underscores.


Template中可以使用参数,语法为{{templatename|parname1=parvalue1|parname2=parvalue2}},在模板中用{{{parname}}}标记,或者使用{{templatename|parvalue1|parvalue2}},在模板中用{{{1}}}, {{{2}}}标记。


  1. This is called a template call or template tag; it has two "braces" on either side of the template page name and doesn't include the "Template:" prefix. {{Template:Tc}} also works, but "Template:" is not necessary. The result is "{{{{{1}}}}}".
  2. The potential difference between the wikitexts {{:The weather in London|a|b|c}} and [[Red link|The weather in London]], now giving The weather in London and The weather in London, is, of course, that after creation of the page the rendering of the first changes and that of the second remains the same, except for the color of the link. The two can be distinguished by the link target (which one may see in the browser in the status bar or a hoverbox), in the case of a piped link. Even with the same target, on wikis without case-sensitivity for the first letter one can recognize an ordinary link as such if the rendered name starts with a lowercase letter, because the rendering of the inclusion code shows the canonical page name: {{:the weather in Londona|b|c}} and [[the weather in London]] give The weather in London and the weather in London.
  3. This prefix can be used in all languages, but the canonical prefixes in languages other than English include Vorlage, Modèle, Sjabloon, with colon (respectively, German, French, and Dutch); the site WikiFAQ calls it Snippet.
  4. Pages in namespaces other than the "Template" namespace can also be used as templates, except for pages in namespaces specified in $wgNonincludableNamespaces. To use a page in the main namespace as a template, add a colon before the page name.


  1. arg: - instead of including a page for given parameter values, this allows linking to a page for given parameter values. Syntax for parameter use: {{arg:parameter name|default}}. Syntax for linking: external link style with "&parameter name=parameter value" added to the URL.

Links to other help pages[编辑]

Help contents
Meta · Wikinews · Wikipedia · Wikiquote · Wiktionary · Commons: · Wikidata · MediaWiki · Wikibooks · Wikisource · MediaWiki: Manual · Google
Versions of this help page (for other languages see further)
What links here on Meta or from Meta · Wikipedia · MediaWiki
Go · Search · Stop words · Namespace · Page name · Section · Backlinks · Redirect · Category · Image page · Special pages · Printable version
Tracking changes
Recent changes (enhanced) | Related changes · Watching pages · Diff · Page history · Edit summary · User contributions · Minor edit · Patrolled edit
Logging in and preferences
Logging in · Preferences · User style
Starting a new page · Advanced editing · Editing FAQ · Edit toolbar · Export · Import · Shortcuts · Edit conflict · Page size
Links · URL · Piped links · Interwiki linking · Footnotes
Style and formatting
Wikitext examples · CSS · Reference card · HTML in wikitext · Formula · List · Table · Sorting · Colors · Images and file uploads
Fixing mistakes
Show preview · Testing · Reverting edits
Advanced functioning
Expansion · Template · Advanced templates · Parser function · Parameter default · Variable · System message · Substitution · Array · Calculation · Embed page
Special characters · Renaming (moving) a page · Preparing a page for translation · Talk page · Signatures · Sandbox · Legal issues for editors