模板:W/doc
本文档是Template:W的文档子页面(见模板页自身)。 本页包含用法信息、分类和其他非原模板页面的内容。 |
Template:W nav 这个模板会生成一个条件链接,如果本地目标存在,则链接到本地目标;如果本地目标不存在,则通常链接到维基百科。
可选的命名参数-anchor
锚链接到维基百科页面的特定部分,并且不试图自动检测本地目标。它应该很少使用;消除使用它的模板调用需要特殊的补救措施。
Examples
编辑参数 | 结果 | 注释 |
---|---|---|
|
澳洲 | 链接到本地分类Category:澳大利亚 ,因为它确实存在。
|
|
澳洲人 | 链接到本地分类Category:澳大利亚 ,因为它确实存在。
|
|
移民和边境保护部 | 链接到维基百科的文章,因为本地分类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
to{{w|...}}
[[...]]
.
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.
foreign=force
links to Wikipedia, without checking for a local target. Categorizes to Category:Pages with forced foreign links.foreign=suppress
behaves as usual for local links, but if the link would be to Wikipedia, the label is unlinked. Does not affect categorization, which is still to Category:Pages with defaulting non-local links.
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).
另请参阅
编辑- {{wikt}}
模板数据
编辑一个生成链接的模板,本地目标页面不存在时,则会连接至链接到维基百科。
参数 | 描述 | 类型 | 状态 | |
---|---|---|---|---|
target | 1 | 链接到的页面 | 字符串 | 必需 |
label | 2 | 代替目标链接显示的文字 | 字符串 | 可选 |
anchor | anchor | 链接到维基百科页面的某一章节 | 字符串 | 可选 |