Template:Ifexist check redirect
Overview[编辑]
The {{Ifexist check redirect}} and {{Ifexist check redirect/if}} templates can be used to identify the status of an article: whether the article exists or not; if it does, whether it is blank, and/or whether an article is a redirect and what type of redirect it is (to a section of an article, or to the general article). This extends upon the use of {{#ifexist}}, which will only check whether the page exists.
Usage[编辑]
{{Ifexist check redirect}} returns one of five values to determine the type of an article; these values are listed in first section of the table below.
{{Ifexist check redirect|ARTICLE}}
{{Ifexist check redirect/if}} provides the same function as {{#if}} and {{#ifexist}}, using the return value of the previous template to provide two cases if the article type matches what is required.
{{Ifexist check redirect/if|ARTICLE|ARTICLE TYPE|IF TRUE|IF FALSE}}
Examples[编辑]
Type of article | Example | Code | Result |
---|---|---|---|
{{Ifexist check redirect}} | |||
Existing article | Wikipedia:Articles for deletion | {{Ifexist check redirect|Wikipedia:Articles for deletion}}
|
noexist |
Redirect to article | MOS:TV | {{Ifexist check redirect|MOS:TV}}
|
article_redirect |
Redirect to section | MOS:SEASON | {{Ifexist check redirect|MOS:SEASON}}
|
noexist |
Empty article | Template:Ifexist check redirect/empty | {{Ifexist check redirect|Template:Ifexist check redirect/empty}}
|
blank |
Non-existent article | Like this one | {{Ifexist check redirect|Like this one}}
|
noexist |
{{Ifexist check redirect/if}} | |||
True case | MOS:TV | {{Ifexist check redirect/if|MOS:TV|article_redirect|Article redirect|Not article redirect}}
|
Article redirect |
False case | MOS:TV | {{Ifexist check redirect/if|MOS:TV|blank|Blank article|Not blank article}}
|
Not blank article |
上述文档嵌入自Template:Ifexist check redirect/doc。 (编辑 | 历史) 编者可以在本模板的沙盒 (创建 | 镜像)和测试样例 (创建)页面进行实验。 请在/doc子页面中添加分类。本模板的子页面。 |