Jump to content

Module:GetShortDescription/doc

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Fred Gandt (talk | contribs) at 07:17, 25 January 2023 (+ Category:WikiProject Short descriptions). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Usage

{{#invoke:GetShortDescription|main |name= |only= |prefer= |fallback= |lang_italic= |lang_nocat= |lang_size= |lang_cat= |lang_rtl= |lang_no= }}

name

By providing only the required page name (including namespace), the module will look for an explicit {{short description}} in that page, but if not found, will try to fetch the wikidata description. If neither are found, the result will be an empty string.

If the result is a wikidata description, and it is declared (at the source) as being of a foreign language (i.e. not en), the result will be wrapped in {{lang}} by default; see #Foreign language wikidata descriptions (below).

This is equivalent to stating |prefer=explicit; see #prefer (below).

Markup: {{#invoke:GetShortDescription|main |name=Example }}
Result: table

only

Providing |only= will limit the search to being only for the stated description. If no description is found, the result will be an empty string, unless a fallback is provided; see #fallback (below).

explicit

Markup: {{#invoke:GetShortDescription|main |name=Example |only=explicit }}
Result:

wikidata

Markup: {{#invoke:GetShortDescription|main |name=Example |only=wikidata }}
Result: table

prefer

Providing |prefer= will initiate the search for the stated description, but try for the alternative if none is found. If no description is found, the result will be an empty string, unless a fallback is provided; see #fallback (below).

explicit or wikidata

Markup: {{#invoke:GetShortDescription|main |name=Example |prefer=explicit }}
Result: table

wikidata or explicit

Markup: {{#invoke:GetShortDescription|main |name=Example |prefer=wikidata }}
Result: table

fallback

If a |fallback= is provided, and no description is found by the expressed route, the result will be the stated fallback.

only or fallback

Markup: {{#invoke:GetShortDescription|main |name=Example |only=explicit |fallback=This is a fallback }}
Result:

prefer or fallback

Markup: {{#invoke:GetShortDescription|main |name=Example |prefer=wikidata |fallback=This is a fallback }}
Result: table

Foreign language wikidata descriptions

Should a wikidata description be retrieved, which is declared (at the source) as being of a foreign language (i.e. not en), per MOS:OTHERLANG, the return will be wrapped in {{lang}} by default; this may be disabled with |lang_no=yes.

The parameters for {{lang}} may be provided via: |lang_italic=, |lang_nocat=, |lang_size=, |lang_cat= and |lang_rtl=; see lang's documentation for details.