Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
<!DOCTYPE html>
<meta charset="utf-8">
<title>Hello world</title>
<link rel="stylesheet" href="">
<div class="pure-g-r" id="layout">
<div class="pure-u-1">
<div class="content">
<div class="posts">
<h1 class="content-subhead">Recent Posts</h1>
<section class="post">
<header class="post-header">
<img class="post-avatar"
alt="avatar" src="/img/common/avatar.png"
height="48" width="48">
<h2 class="post-title">Post Title</h2>
<p class="post-meta">
By <a class="post-author" href="#">Author</a> under <a class="post-category" href="#">Category</a>
<div class="post-description">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
; this is not executable, check tutorial for some helper functions
(defn get-posts []
(jdbc/query db-spec (sql/select * :posts (sql/order-by {:id :desc}))))
(html/defsnippet post "blog.html" []
[{avatar :avatar title :title author :author category :tag}]
[] (html/set-attr :src (gravatar ""))
[] (html/content title)
[] (maybe-content author)
[] (maybe-content category))
(html/deftemplate blog "blog.html"
[:title] (html/content "dsds")
[:.posts] (html/content (map post (get-posts))))
(render-to-response (blog {}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment