Page MenuHomePhabricator

New lua function to follow entity redirects
Open, Needs TriagePublic

Description

i.e. get the target of a redirect.

Event Timeline

This works on Wikidata only, not on cilents.

@Bugreporater, if you have a item ID and you want to find out if it is a redirect than you can use

function folowRedirect(id)
	return mw.wikibase.getEntity(id).id
end

It works, and folowRedirect('Q50940519') will give you "Q9178333". It is useful if working with whole entities.

getEntity is expensive, usage should be avoided.

I agree, That is why I use this approach for pages where I load the whole entity anyway. Many infoboxes on commons are created based on item ID and for those we load the whole entity.