diff --git a/blog.html b/blog.html
index ab3e0eb..17f73c8 100644
--- a/blog.html
+++ b/blog.html
@@ -1,3 +1,11 @@
Posts
+$list_posts2{limit = 3}[[
+
+]]
+
$list_posts
diff --git a/site.moon b/site.moon
index 4bb6fdc..5c6f29b 100644
--- a/site.moon
+++ b/site.moon
@@ -58,6 +58,16 @@ 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
+posts2 = (path=".") ->
+ files = reverse get_files path
+
+ [{
+ path: join(path, file)
+ target: Path.join Path.basepath(target(file, "/posts")), extract_id(join(path, file))
+ post_id: extract_id join(path, file)
+ publish_date: publish_date join(path, file)
+ } for file in *files]
+
common = require("sitegen.common")
h = (word) -> word\sub(1, 1)\upper!
t = (word) -> word\sub(2, -1)\lower!
@@ -83,7 +93,34 @@ list_posts = (page, limit) ->
}
} for { meta: meta, source: source } in *posts[1, limit or #posts]]
+-- list_posts2 = (page) ->
+-- posts = page.site\query_pages { is_a: "post" }
+-- table.sort posts, (a, b) -> a.source > b.source
+--
+-- list = [{
+-- target: meta.target
+-- post_title: meta.title or table.concat(titleize_slug(meta.id), " ")
+-- publish_date: publish_date source
+-- } for { meta: meta, source: source } in *posts[1, limit or #posts]]
+-- p list
+-- list
+
cosmo = require "sitegen.cosmo"
+
+list_posts2 = (page, arg={}) ->
+ posts = page.site\query_pages { is_a: "post" }
+ table.sort posts, (a, b) -> a.source > b.source
+
+ list = [{
+ target: meta.target
+ post_title: meta.title or table.concat(titleize_slug(meta.id), " ")
+ publish_date: publish_date source
+ blurb: meta.blurb
+ } for { meta: meta, source: source } in *posts[1, arg.limit or #posts]]
+
+ for post in *list
+ cosmo.yield post
+
html_renderer = require "sitegen.renderers.html"
html_renderer.cosmo_helpers.if = (args, has_block) => cosmo.cif args, has_block
html_renderer.cosmo_helpers.titleize = (slug) => html.build ->
@@ -94,6 +131,7 @@ sitegen.create =>
@app_name = "stasis"
@version = "0.2.12"
@list_posts = list_posts
+ @list_posts2 = list_posts2
add "index.html", title: "Catalin Mititiuc"
add "blog.html", title: "Posts", target: "posts/index", template: "blog"