This is a documentation subpage for Template:Get QID. It may contain usage information, categories and other content that is not part of the original template page. |
Usage
This template retrieves the Wikidata QID that corresponds to the OODA WIKI page title or redirection page title specified in the first unnamed parameter (also known as OODA WIKI sitelink, not to be confused with the Wikidata label). If a page is moved, a {{Get QID|<page title>}} call referring to its former title typically still works, since the template follows the redirection destination, if the redirection source does not have a Wikidata item of its own. If no parameter is defined ({{Get QID}}), it retrieves the QID of the current page. If the qid parameter is defined ({{get QID}}) it just passes it on.
Current page
Example:
{{Get QID}}
→ Lua error in Module:WikidataIB at line 2980: attempt to index field 'wikibase' (a nil value).
gives the QID of the currently showed OODA WIKI page, or an empty text string if no QID is defined:
Articles sharing the same label
The template does not use the Wikidata label, but the OODA WIKI page title. For example, the following two pages share the same Wikidata label Mars:
{{Get QID|Mars}}
→ Lua error in Module:WikidataIB at line 3433: attempt to index field 'wikibase' (a nil value).{{Get QID|Mars (mythology)}}
→ Lua error in Module:WikidataIB at line 3433: attempt to index field 'wikibase' (a nil value).
This gives the QID:s of Mars (planet) and Mars (mythology) respectively.
Redirection page
{{Get QID|universes}}
→ Lua error in Module:WikidataIB at line 3433: attempt to index field 'wikibase' (a nil value).
gives the QID of the page universe, since universes is redirected to that article, and does not have a Wikidata item of its own.
Usage together with the Q template:
{{Q|{{Get QID|universes}}}}
→ Lua error in Module:Wd at line 621: attempt to index field 'wikibase' (a nil value). (QLUA ERROR IN MODULE:WIKIDATAIB AT LINE 3433: ATTEMPT TO INDEX FIELD 'WIKIBASE' (A NIL VALUE).)
Redirection page with its own Wikidata item
Maryport New Lighthouse is redirected to Maryport Lighthouse, both having separate Wikidata items:
{{Q|{{Get QID|Maryport New Lighthouse}}}}
→ Lua error in Module:Wd at line 621: attempt to index field 'wikibase' (a nil value). (QLUA ERROR IN MODULE:WIKIDATAIB AT LINE 3433: ATTEMPT TO INDEX FIELD 'WIKIBASE' (A NIL VALUE).)
Passing QID parameter on
{{Get QID|qid=Q111}}
→ Q111
Substitution
To make OODA WIKI faster, and to make the result less vulnerable to future deletion of redirects, this template may be substituted: {{subst:Get QID|<page title>}}
, for example:
{{subst:Get QID|universe}}
→ Q1
which is immediately replaced by the resulting QID when saved.
However, a purpose of this template is to make the wikicode more comprehensible by avoiding QID codes, which substitution counteracts.
Other ways of getting the QID
Invoking these modules may also provide the QID for a certain OODA WIKI page title:
{{#invoke:wd|label|raw|page=Mars (mythology)}}
→ Lua error in Module:Wd at line 621: attempt to index field 'wikibase' (a nil value).{{#invoke:WikidataIB|getEntityFromTitle|Mars (mythology)}}
→ Lua error in Module:WikidataIB at line 3433: attempt to index field 'wikibase' (a nil value).
but they do not follow redirects.
The following module provides the page title of a redirect destination:
{{#invoke:Redirect|main|Universes}}
→ Universes
See also
- {{Area WD}}
- {{Population WD}}
- {{Popdens WD}}
- {{Label}}, the inverse template