Template: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 | 鏈接到維基百科頁面的某一章節 | 字符串 | 可选 |