summaryrefslogtreecommitdiff
path: root/src/Hakyll/Web/Feed.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Hakyll/Web/Feed.hs')
-rw-r--r--src/Hakyll/Web/Feed.hs14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/Hakyll/Web/Feed.hs b/src/Hakyll/Web/Feed.hs
index 16b6dc0..f40fa8a 100644
--- a/src/Hakyll/Web/Feed.hs
+++ b/src/Hakyll/Web/Feed.hs
@@ -24,16 +24,11 @@ module Hakyll.Web.Feed
--------------------------------------------------------------------------------
-import Control.Monad ((<=<))
-
-
---------------------------------------------------------------------------------
import Hakyll.Core.Compiler
import Hakyll.Core.Compiler.Internal
import Hakyll.Core.Item
import Hakyll.Web.Template
import Hakyll.Web.Template.Context
-import Hakyll.Web.Template.Internal
import Hakyll.Web.Template.List
@@ -66,17 +61,16 @@ renderFeed :: FilePath -- ^ Feed template
-> [Item String] -- ^ Input items
-> Compiler (Item String) -- ^ Resulting item
renderFeed feedPath itemPath config itemContext items = do
- feedTpl <- compilerUnsafeIO $ loadTemplate feedPath
- itemTpl <- compilerUnsafeIO $ loadTemplate itemPath
+ feedTpl <- loadTemplate feedPath
+ itemTpl <- loadTemplate itemPath
body <- makeItem =<< applyTemplateList itemTpl itemContext' items
applyTemplate feedTpl feedContext body
where
-- Auxiliary: load a template from a datafile
loadTemplate path = do
- file <- getDataFileName path
- templ <- readFile file
- return $ readTemplateFile file templ
+ file <- compilerUnsafeIO $ getDataFileName path
+ unsafeReadTemplateFile file
itemContext' = mconcat
[ itemContext