summaryrefslogtreecommitdiff
path: root/src/Hakyll
diff options
context:
space:
mode:
authorBergi <a.d.bergi@web.de>2015-10-21 22:14:39 +0200
committerBergi <a.d.bergi@web.de>2015-10-24 20:29:10 +0200
commit5a4ae4147313f52d50ff3bd9d74340a86175a5d9 (patch)
tree1a2ea03e694947f7f8d4b7c3b1dd123b7d9226d8 /src/Hakyll
parent8dec0a51fbcab519755147828b546abdb397fbd8 (diff)
downloadhakyll-5a4ae4147313f52d50ff3bd9d74340a86175a5d9.tar.gz
templateBodyCompiler compiles resource body only
and becomes the new default, instead of templateCompiler fixes #378
Diffstat (limited to 'src/Hakyll')
-rw-r--r--src/Hakyll/Web/Template.hs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/Hakyll/Web/Template.hs b/src/Hakyll/Web/Template.hs
index d28ce08..194949d 100644
--- a/src/Hakyll/Web/Template.hs
+++ b/src/Hakyll/Web/Template.hs
@@ -118,6 +118,7 @@
{-# LANGUAGE ScopedTypeVariables #-}
module Hakyll.Web.Template
( Template
+ , templateBodyCompiler
, templateCompiler
, applyTemplate
, loadAndApplyTemplate
@@ -143,7 +144,14 @@ import Hakyll.Web.Template.Internal
--------------------------------------------------------------------------------
--- | Read a template.
+-- | Read a template, without metadata header
+templateBodyCompiler :: Compiler (Item Template)
+templateBodyCompiler = cached "Hakyll.Web.Template.templateBodyCompiler" $ do
+ item <- getResourceBody
+ return $ fmap readTemplate item
+
+--------------------------------------------------------------------------------
+-- | Read complete file contents as a template
templateCompiler :: Compiler (Item Template)
templateCompiler = cached "Hakyll.Web.Template.templateCompiler" $ do
item <- getResourceString