跳转到内容

Template:W/doc

维基新闻,自由的新闻源
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

鏈接到維基百科頁面的某一章節

字符串可选