miniblog

Miniblog: A command-line static blog system in Common Lisp
Log | Files | Refs | README | LICENSE

template.lhtml (1683B)


      1 <!DOCTYPE html>
      2 <html>
      3   <% @include html-head.lhtml %>
      4   <body>
      5     <% @include header.lhtml %>
      6     <% @include left-column.lhtml %>
      7     <section id="miniblog-main">
      8       <% @if posts %>
      9         <% (let ((short-date) (render-hr nil)) %>
     10           <% (loop for post in (getf env :posts) do %>
     11             <% (destructuring-bind (&key id created-at created-at-short created-at-long last-updated-at last-updated-at-long title content created-by last-updated-by &allow-other-keys) post %>
     12               <% (let ((curr-short-date created-at-short)) %>
     13                 <% (if render-hr %>
     14                   <hr>
     15                 <% ) %>
     16                 <% (setf render-hr t) %>
     17                 <% (if (string/= short-date curr-short-date)
     18                      (progn
     19                        (setf short-date curr-short-date)
     20                        (format t "<h1>~A</h1>~%" short-date)))) %>
     21               <a name="<%= id %>"></a>
     22               <h2><%= title %></h2>
     23               <article>
     24                 <%= (funcall (getf env :content-formatter) content) %>
     25               </article>
     26               <p>
     27                 <small>
     28                   Posted by <%= created-by %> on
     29                   <%= created-at-long %>
     30                   <% (if (local-time:timestamp/= created-at last-updated-at)
     31                        (format t "<br>~%Last updated by ~A on ~A~%"
     32                                last-updated-by
     33                                last-updated-at-long)) %>
     34                 </small>
     35               </p>
     36             <% ) %>
     37           <% ) %>
     38         <% ) %>
     39       <% @else %>
     40         No posts found.
     41       <% @endif %>
     42     </section>
     43     <% @include nav.lhtml %>
     44   </body>
     45 </html>