From a249d9368a77d92e2d701f7274a34e5c5fb581ec Mon Sep 17 00:00:00 2001 From: Lucian Mogosanu Date: Sat, 20 Jul 2013 13:01:53 +0300 Subject: [PATCH] site: compile optional teaser --- site.hs | 7 ++++++- templates/teaser.html | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 templates/teaser.html 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$ -- 1.7.10.4