include "pages/page.wl" let posts = $query("SELECT P.id, P.title, P.is_link, P.content, (SELECT COUNT(*) FROM Comments as C WHERE c.parent_post=P.id) as num_comments, CURRENT_TIMESTAMP as date FROM Posts as P") if posts == none: posts = [] let style = let main =
\if len(posts) == 0:
There are no posts yet!
\for post in posts: { let link if post.is_link != 0: link = post.content else link = ["/post?id=", post.id]
\escape(post.title)
\escape(post.date) | \escape(post.num_comments) comments
}
page("Index", $login_user_id, style, main)