summaryrefslogtreecommitdiff
path: root/site.hs
diff options
context:
space:
mode:
Diffstat (limited to 'site.hs')
-rw-r--r--site.hs20
1 files changed, 20 insertions, 0 deletions
diff --git a/site.hs b/site.hs
index fd7f541..350d999 100644
--- a/site.hs
+++ b/site.hs
@@ -13,6 +13,15 @@ config = defaultConfiguration
{ deployCommand =
"rsync -Havz _site/ rekado@elephly.net:/srv/disk1/rekado/elephly.net" }
+myFeedConfiguration :: FeedConfiguration
+myFeedConfiguration = FeedConfiguration
+ { feedTitle = "Rekado's website"
+ , feedDescription = "Music, words, and hacking"
+ , feedAuthorName = "Rekado"
+ , feedAuthorEmail = "rekado+feed@elephly.net"
+ , feedRoot = "http://elephly.net"
+ }
+
--------------------------------------------------------------------------------
main :: IO ()
main = hakyllWith config $ do
@@ -76,6 +85,9 @@ main = hakyllWith config $ do
>>= loadAndApplyTemplate "templates/default.html" archiveCtx
>>= relativizeUrls
+ create ["rss.xml"] $ postFeed renderRss
+ create ["atom.xml"] $ postFeed renderAtom
+
-- always show the most recent blog post
create ["index.html"] $ do
route idRoute
@@ -108,6 +120,13 @@ photoSnippet = snippet "photo-snippet" "photo" "templates/photo.html"
flattrSnippet = snippet "flattr-snippet" "flattr" "templates/flattr.html"
licenseSnippet = snippet "license-snippet" "license" "templates/license.html"
+postFeed renderer = do
+ route idRoute
+ compile $ do
+ let feedCtx = postCtx `mappend` bodyField "description"
+ posts <- fmap (take 10) . recentFirst =<<
+ loadAllSnapshots "posts/*.markdown" "content"
+ renderer myFeedConfiguration feedCtx posts
--------------------------------------------------------------------------------
postList :: ([Item String] -> Compiler [Item String]) -> Compiler String
@@ -128,6 +147,7 @@ customPandocCompiler =
defaultCompiler = customPandocCompiler
>>= loadAndApplyTemplate "templates/post.html" postCtx
+ >>= saveSnapshot "content"
>>= loadAndApplyTemplate "templates/default.html" postCtx
>>= saveSnapshot "non-relative"
>>= relativizeUrls