From: Lucian Mogosanu Date: Sat, 20 Jul 2013 10:01:53 +0000 (+0300) Subject: site: compile optional teaser X-Git-Tag: v0.1~30 X-Git-Url: https://git.mogosanu.ro/?a=commitdiff_plain;h=a249d9368a77d92e2d701f7274a34e5c5fb581ec;p=thetarpit.git site: compile optional teaser --- diff --git a/site.hs b/site.hs index 27630fd..e95ca1e 100644 --- a/site.hs +++ b/site.hs @@ -67,8 +67,13 @@ compileRss = do -- http://jaspervdj.be/hakyll/tutorials/05-snapshots-feeds.html route idRoute compile $ do - let feedCtx = postCtx `mappend` bodyField "description" + let feedCtx = + postCtx `mappend` + teaserField "teaser" "content" `mappend` + bodyField "description" + applyTeaser = loadAndApplyTemplate "templates/teaser.html" feedCtx posts <- loadAllSnapshots "posts/*" "content" + >>= mapM applyTeaser >>= fmap (take 7) . recentFirst renderRss tarpitFeed feedCtx posts diff --git a/templates/teaser.html b/templates/teaser.html new file mode 100644 index 0000000..ad39f51 --- /dev/null +++ b/templates/teaser.html @@ -0,0 +1,5 @@ +$if(teaser)$ + $teaser$ +$else$ + $body$ +$endif$