跳转到内容

模板:Short description/doc

来自代码酷
Admin留言 | 贡献2025年5月1日 (四) 21:16的版本 (导入1个版本)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)

模板:Pp

Template:Short description is used to add a short description (which can be edited from within Wikipedia) to a Wikipedia page. These descriptions appear in Wikipedia searches and elsewhere, and help users identify the desired article.

Usage[编辑源代码]

{{Short description|Write your short description here}}

This should be limited to about 40 characters, as explained at WP:SDFORMAT, along with the other guidance at WP:SDCONTENT.

If the page's title is sufficiently descriptive that a short description is not needed, use the following:

{{Short description|none}}

Parameters[编辑源代码]

See a monthly parameter usage report for Template:Short description in articles based on its TemplateData.

TemplateData for Short description

Creates a short description for a Wikipedia page, which is displayed in search results and other locations.

模板参数

此模板有自定义格式。

参数描述类型状态
Description1

The short description of the article or 'none'. It should be limited to about 40 characters.

示例值
Endangered species of South American fish
内容必需
No replace?2

Should be unused or 'noreplace'. Templates with noreplace will not replace a short description defined by an earlier template. Mainly for use within transcluded templates.

推荐值
noreplace
自动值
noreplace
字符串可选
pagetypepagetype

The type of page. This puts it in the appropriate category - Things with short description. Normally unneeded, since handled through namespace detection.

示例值
Redirect, Disambiguation page
字符串可选

About writing good short descriptions[编辑源代码]

This page is about the short description template; it does not provide guidelines for writing a good short description. If you plan to use this template, you should make sure you read and follow the detailed guidance at WP:HOWTOSD. General information can be found at Wikipedia:Short description.

Template information[编辑源代码]

Eventually all articles should have a short description:

  • by directly using this template, in which case the short description will be unique to the article
  • transcluded in another template, such as a disambiguation template, where a generic short description is adequate for a large class of pages
  • where the short description is assembled from data in an infobox

Automatically generated descriptions within templates should set the second parameter as

noreplace

so they do not override any short descriptions specifically added to the transcluding article.

Short descriptions are not normally needed for non-article pages, such as redirects, but can be added if useful.

If the article title alone is sufficient to ensure reliable identification of the desired article, a null value of {{Short description|none}} may be used.

Short descriptions do not necessarily serve the same function as the Wikidata description for an item and they do not have to be the same, but some overlap is expected in many cases. Some Wikidata descriptions may be unsuitable, and if imported must be checked for relevance, accuracy and fitness for purpose. Responsibility for such imports lies with the importer. (See also Wikidata:Help:Description.)

Example[编辑源代码]

At Oxygen therapy, add the following at the very top of the article, above everything else:

  • {{Short description|Use of oxygen as medical treatment}}

Testing[编辑源代码]

For testing purposes, the display of this template can be enabled by adding a line to your Special:MyPage/common.css:

  • .shortdescription { display:block !important; }

This can be easily removed or disabled when testing is finished.

If you want to always see short descriptions, you may prefer a more utilitarian layout, such as:

.shortdescription {
  display:block !important;
  white-space: pre-wrap;
}
.shortdescription::before { 
  content: "\A[Short description:\0020";
}
.shortdescription::after { 
  content: "]\A";
}

There is a test version of this template available as Template:Short description/test which displays its text by default.

  • {{Short description/test}} displays the short description if supplied
  • {{Short description/test}} displays nothing if none is supplied
  • {{Short description/test}} displays the description from Wikidata if wikidata is supplied.

Taking 模块:Wd第632行Lua错误:attempt to index field 'wikibase' (a nil value) (Q1096878) as an example:

  • {{short description/test|Underwater diving where breathing is from equipment independent of the surface}}Underwater diving where breathing is from equipment independent of the surface
  • {{short description/test|none}}
  • {{short description/test|wikidata}}<strong class="error"><span class="scribunto-error mw-scribunto-error-0804ddcd">模块:WikidataIB第2750行Lua错误:attempt to index field &#039;wikibase&#039; (a nil value)</span></strong>

Pagetype parameter[编辑源代码]

If {{{Pagetype}}} is not set, then this template adds the article to a category based on the namespace:

If {{{Pagetype}}} is set, then this template adds the article to a category matching the parameter. For example:

Aliases[编辑源代码]

While there are currently redirects to this template, they must not be used, for the reasons below:

  • Other templates and gadgets attempt to extract short descriptions from pages by explicitly searching for the transclusions of the {{Short description}} template.
  • For example, {{Annotated link}} searches for the template in its uppercase "Short description" and lowercase form "short description"; either form is acceptable.

See related RfD.

Do not start the template with a space:

 {{ Short description...

. While this does create a valid short description, the space will prevent searches for the

{{Short description...

text.

Tracking categories[编辑源代码]

Maintenance categories[编辑源代码]

See also[编辑源代码]