Module:PopularArticles
Appearance
Documentation for this module may be created at Module:PopularArticles/doc
local p = {}
function p.main(frame)
local pages = mw.ext.dpl.getPages{
category = "Theses",
ordermethod = "counter",
order = "descending",
count = 1
}
if not pages or #pages == 0 then
return "No pages found."
end
local output = {}
for i, page in ipairs(pages) do
local title = page.prefixedText or page.title or "Unknown page"
local counter = page.counter or 0
table.insert(
output,
string.format(
"%d. [[%s]] — %s views",
i,
title,
mw.language.getContentLanguage():formatNum(counter)
)
)
end
return table.concat(output, "\n")
end
return p