{- | This module defines the 'page' function for rendering an individual blog post or list of blog posts. -} {-# LANGUAGE RecordWildCards #-} {-# OPTIONS_GHC -F -pgmFtrhsx #-} module Theme.Blog where import Clckwrks import Data.Maybe import Data.Text (Text, pack, unpack) import Theme.Template -- | create a list of of all the blog posts postsHTML :: XMLGenT (Clck ClckURL) XML postsHTML = do posts <- getPosts
    <% mapM postHTML posts %>
-- | create a the \ for a single blog post postHTML :: Page -> XMLGenT (Clck ClckURL) XML postHTML Page{..} =
  • <% pageTitle %>

    Posted on <% pageDate %> by <% authorName %> <% pageSrc %>

    permalink

  • where authorName :: Clck ClckURL Text authorName = do mu <- getUsername pageAuthor return $ fromMaybe (pack "Anonymous") mu page :: XMLGenT (Clck ClckURL) XML page = do ttl <- lift getBlogTitle template (unpack ttl) () $ <%>

    <% ttl %>

    <% postsHTML %>