模板: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 | 鏈接到維基百科頁面的某一章節 | 字串 | 非必填 |
上述文件嵌入自Template:W/doc。 (編輯 | 歷史) 編者可以在本模板的沙盒 (編輯 | 差異)和測試樣例 (建立)頁面進行實驗。 請在/doc子頁面中添加分類。 本模板的子頁面。 |