diff options
Diffstat (limited to 'blogindex.lua')
-rw-r--r-- | blogindex.lua | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/blogindex.lua b/blogindex.lua new file mode 100644 index 0000000..4322164 --- /dev/null +++ b/blogindex.lua @@ -0,0 +1,37 @@ +require'h' + +local head = mkhead'blog listing' +local top = mktopbox('/me.png','rebecca blog',p'page listing') +local bread = bcrumb{ + {'< home','/'}, + {'rebecca blog'} +} + +local metas={} +local posix = require'posix' +for fname in posix.dirent.files'blog' do + if fname:sub(1,1) ~= '.' then + local meta = loadfile('blog/'..fname)(true) + meta.fname = meta.fname or fname:gsub('%.lua$','') + table.insert(metas,meta) + end +end +table.sort(metas,function(a,b) return a.date>b.date end) + +local list = {} +for _,it in ipairs(metas) do + table.insert(list, li{ + tag('time',{datetime=it.date},it.date), + a(it.title,'/blog/'..it.fname..'.html') + }) +end + +local listsect = section { + p'the', + ul({class="postlist"},list) +} + + +print(html{ + head, top, bread, listsect +}) |