date = require "date" path = require "sitegen.path" -- import slugify from "sitegen.common" common = require "sitegen.common" rootname = (str) -> result = string.gsub str, "%..+", "" result extract_id = (source) -> string.match path.filename(source), "%a[%w%-]+" extract_date = (source) -> string.match path.filename(source), "%d+%-%d%d%-%d%d" format_date = (str) -> date(str)\fmt "%b %d, %Y" publish_date = (path) -> format_date extract_date path pages = site\query_pages { is_a: "post" } table.sort pages, (a, b) -> a.source > b.source html -> [tag["section"] { tag["h3"] { tag["a"] { href: p.meta.target .. ".html", p.meta.title or p.meta.id } } tag["time"] { publish_date p.source } { "—", if p.meta.blurb then text p.meta.blurb } tag["a"] { class: "read-post-link", href: p.meta.target .. ".html", "Read post →" } } for _, p in ipairs pages]