sitegen = require "sitegen" lfs = require "lfs" files = (path="docs") -> ["#{path}/#{file}" for file in lfs.dir(path) when file != "." and file != ".."] rootname = (str) -> string.gsub str, "%.+", "" last = (list) -> list[#list] split = (str, delimiter) -> [capture for capture in string.gmatch str, "[^#{delimiter}]+"] target = (path, delimeter="/") -> "/posts/#{rootname(last(split(path, delimeter)))}" sitegen.create => @title = "Hello World" add "index.md" add path, target: target(path) for _, path in ipairs files!