import emerald, os, streams, strutils proc getItems(): seq[string] = result = newSeq[string]() for kind, path in walkDir("."): if (path.endsWith "thumbs") or (path.endsWith "index.html"): continue result.add(path) proc indexTemplate(files: seq[string]) {.html_templ.} = html(lang = "en"): head: title: "Image Archive" link(rel="stylesheet", `type`="text/css", href="/css/solarized-dark.min.css") body: h1: "Image Archive" a(href=".."): "Go back" br(); br(); br() d(style="text-align: center"): for path in files.items(): a(href=path): img(src="thumbs/" & path & ".thumb.png") when isMainModule: var files = getItems() fs = newFileStream("index.html", fmWrite) myTempl = newIndexTemplate() myTempl.files = files myTempl.render(fs)