48,407
edits
No edit summary |
No edit summary |
||
| Line 190: | Line 190: | ||
-- Otherwise, check the Wikidata item for a sitelink. | -- Otherwise, check the Wikidata item for a sitelink. | ||
local item = self:getWikidataItem() | local item = self:getWikidataItem() | ||
article = item and sitelink(item, project) or false | article = item and sitelink(item, project) or self:getCanonicalName() or false | ||
if article then | if article then | ||
return article | return "w:" .. article | ||
end | end | ||
-- If there's still no article, try the parent (if any). | -- If there's still no article, try the parent (if any). | ||
| Line 256: | Line 256: | ||
local function get_commons_cat_sitelink(item) | local function get_commons_cat_sitelink(item) | ||
if item then | --[[if item then | ||
local commons_sitelink = sitelink(item, "commonswiki") | local commons_sitelink = sitelink(item, "commonswiki") | ||
-- Reject any sitelinks that aren't categories. | -- Reject any sitelinks that aren't categories. | ||
return commons_sitelink and match(commons_sitelink, "^Category:") and commons_sitelink or nil | return commons_sitelink and match(commons_sitelink, "^Category:") and commons_sitelink or nil | ||
end | end]] | ||
return nil | |||
end | end | ||