${query[[
from
p = index.tag 'page'
where
p.perm == 'rw' and
not table.includes(p.itags, 'meta') and
not table.includes(p.itags, 'meta/template') and
not table.includes(p.itags, 'meta/template/page') and
not p.name.startsWith('Inbox/')
select {
['Name'] = '[[' .. p.name .. '|' .. p.name:gsub('^/', '') .. ']]',
['Modified'] = p.lastModified:gsub('T', ' '),
['Tags'] = tagList(p.name)['markdown']
}
order by
p.lastModified desc
limit
10
]]}
```space-lua
function tagList(page)
local page = page
local grouped = {}
local counts = {}
local sortedLetters = {}
local inputTable = query[[
from t = index.tag 'tag'
order by t.name
where t.page == (page or t.page)
select {N = t.name, P = t.parent, PG = t.page}
]]
for _, str in ipairs(inputTable) do
local firstChar = string.sub(str.N, 1, 1)
firstChar = string.upper(firstChar)
if not grouped[firstChar] then
grouped[firstChar] = {}
end
table.insert(grouped[firstChar], str.N)
end
for letter in pairs(grouped) do
table.insert(sortedLetters, letter)
end
table.sort(sortedLetters) -- sort alphabetically
local output = ""
for _, letter in ipairs(sortedLetters) do
local uniqueWords = {}
output = output .. '**' .. letter .. '** '
for _, word in ipairs(grouped[letter]) do
if counts[word] then
counts[word] = counts[word] + 1
else
counts[word] = 1
table.insert(uniqueWords, word)
end
end
for i, word in ipairs(uniqueWords) do
output = output .. '#' .. word
if counts[word] > 1 then
output = output .. "^(" .. counts[word] .. ")^"
end
if i < #uniqueWords then
output = output .. " "
end
end
output = output .. "\n"
end
return widget.new{
markdown = output;
display = "block";
cssClasses = {
"taglist"
}
}
end
```