文档图示 模板文档[查看] [编辑] [历史] [清除缓存]
create use count

Template:W nav 这个模板会生成一个条件链接,如果本地目标存在,则链接到本地目标;如果本地目标不存在,则通常链接到维基百科。

{{w|目標}}
{{w|目標|標籤}}
{{w|目標|anchor=章節|標籤}}

可选的命名参数-anchor锚链接到维基百科页面的特定部分,并且不试图自动检测本地目标。它应该很少使用;消除使用它的模板调用需要特殊的补救措施。

Examples

编辑
参数 结果 注释
{{w|澳大利亚}} 澳洲 链接到本地分类Category:澳大利亚,因为它确实存在。
{{w|澳大利亚|澳洲人}} 澳洲人 链接到本地分类Category:澳大利亚,因为它确实存在。
{{w|移民和邊境保護部}} 移民和边境保护部 链接到维基百科的文章,因为本地分类Category:移民和邊境保護部并不存在。

移除

编辑

Exercise care when removing calls to this template from a page: it is used, in part, to keep track of page categorization.

  • If the local target doesn't exist, you probably shouldn't be removing the template call.
  • If the local target does exist, consider whether the calling page should belong to some category associated with the local target, and if it should belong but doesn't, add it to that category. Then eliminate the locally linking template call by changing {{w|...}} to [[...]].

This template populates three hidden categories: when linking to Wikipedia (without an anchor), it adds the calling page to Category:Pages with defaulting non-local links; when linking to the local target, it adds the calling page to Category:Pages with categorizable local links; when linking to Wikipedia with an anchor, it adds the calling page to Category:Pages with forced foreign links.

A gadget is provided to complement this template, "Underline in green categorizable {{w}} links". The gadget also puts a dashed underline on forced foreign {{w}} links.

其他参数

编辑

Optional parameter nocat can be set to any non-blank value to suppress categorization of the calling page based on this template call.

Optional parameter foreign can be set to either of two values to cause specialized effects. This optional parameter is ignored if anchor is used.

Optional parameter sister can be set to the wikilink prefix of a sister other than Wikipedia, to override Wikipedia as the choice of non-local target when wikilinking non-locally. It has no effect on whether a non-local wikilink is provided, only on the target when used. Omit the trailing ":" from the prefix. For example, {{w|Somalia|sister=wikt|foreign=force}} would link to wikt:Somalia. There's a table of the prefixes for various sisters at meta. For non-English languages, use the sister prefix, a colon, and the language code; for example, {{w|sister=w:fr|Souhail Alouini}} would link to Souhail Alouini (as of this writing, Souhail Alouini has no local target and no en.wp target).

另请参阅

编辑

模板数据

编辑

一个生成链接的模板,本地目标页面不存在时,则会连接至链接到维基百科。

模板参数[编辑模板数据]

参数描述类型状态
target1

链接到的页面

字符串必需
label2

代替目标链接显示的文字

字符串可选
anchoranchor

链接到维基百科页面的某一章节

字符串可选