yg.t_bc = template.new[==[/[[${name}]] ]==]
yg.t_bcsub = template.new[==[-[[${name}]] ]==]
function yg.breadcrumbs(path)
local mypage = path or editor.getCurrentPage()
local parts = string.split(mypage,"/")
local crumbs = {}
for i,part in ipairs(parts) do
local current = ""
for j=1,i do
if current ~= "" then
current=current.."/"
end
current = current..parts[j]
end
table.insert(crumbs, {name = current})
end
return crumbs
end
function yg.bc(path)
return "[[home]]"..(template.each(yg.breadcrumbs(path),yg.t_bc)).." "..(template.each(yg.children(path),yg.t_bcsub))
end
function compareDate(a, b)
print(a.lastModified > b.lastModified )
return a.lastModified > b.lastModified
end
function yg.children(path)
local crumbsChildren = {}
local mypage = path or editor.getCurrentPage()
for page in each(table.sort(space.listPages(), compareDate)) do
--print(mypage,page.name,string.find(page.name,mypage) )
if (string.find(page.name,mypage) and mypage ~= page.name and #crumbsChildren <7)
then
table.insert(crumbsChildren, {name = page.ref})
end
end
return crumbsChildren
end
parent and last 7 modified children are visible in breadcrumbs.