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 03:43, 23 January 2023 (updating links, invocations and references since move). 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= }}

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 as being non-English (en), the result will be wrapped in {{lang}}; see #Non-English wikidata descriptions (below).

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

Code: {{#invoke:GetShortDescription|main |name=Example }}

Result: table

Only

Stating |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 or nothing

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

Result:

Wikidata or nothing

Code: {{#invoke:GetShortDescription|main |name=Example |only=wikidata }}

Result: table

Prefer

Stating |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 or nothing

Code: {{#invoke:GetShortDescription|main |name=Example |prefer=explicit }}

Result: table

Wikidata or explicit or nothing

Code: {{#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

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

Result:

Prefer or fallback

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

Result: table

Non-English wikidata descriptions

Should a wikidata description be retrieved, which is declared as being non-English (en), the return will be wrapped in {{lang}}.

The parameters for {{lang}} may be provided via: |lang_italic=, |lang_nocat=, |lang_size=, |lang_cat= and |lang_rtl=.