Page MenuHomePhabricator

Allows to retrieve a Wikibase entity from a page name in Lua
Closed, DuplicatePublic


It would be nice to have a function that allows to retrieve an entity (or just its id) for given page in the current wiki (and maybe also from pages from the other wikis).

It would be useful in order to enhance output of templates that have as parameter a wiki page name with data from Wikidata without having to request template user to fill the Wikidata entity id too

Possible names/signatures:

  • mw.wikibase.getEntityForTitle(title: mw.Title) -> mw.wikibase.Entity
  • mw.wikibase.getEntityIdForTitle(title: mw.Title) -> string
  • mw.wikibase.getEntityForSitelink(title: string, site: string) -> mw.wikibase.Entity
  • mw.wikibase.getEntityIdForSitelink(title: string, site: string)

Remark: It is probably not a good idea to have "Item" in the name of the function as it could probably be used also to retrieve Lexemes from Wiktionary pages names.