Template:Get QID/doc

Usage
This template retrieves the QID that corresponds to the Wikipedia page title or redirection page title specified in the first unnamed parameter (also kown as Wikipedia sitelink, not to be confused with the Wikidata label). If a page is moved, a call referring to its former title 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, it retrieves the QID of the current page. If the qid parameter is defined it just passes it on.

Current page
Example: gives the qid of the currently showed Wikipedia 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 Wikipedia page title. For example, the following two pages share the same Wikidata label mars: gives the qid of mars (planet):

gives the qid of mars (mythology):

Redirection page
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: gives

Redirection page with its own Wikidata item
Maryport New Lighthouse is redirected to Maryport Lighthouse, both having separate Wikidata items. gives

Passing qid parameter on
gives