@@ -87,14 +87,18 @@ applyTemplate' tpl context x = go tpl
8787 context' = unContext (context `mappend` missingField)
8888 go = liftM concat . mapM applyElem . unTemplate
8989
90− applyElem (Chunk c) = return c
91− applyElem Escaped = return "$"
92− applyElem (Key k) = context' k x >>= getString k
90+ applyElem (Chunk c) = return c
91+
92+ applyElem Escaped = return "$"
93+
94+ applyElem (Key k) = context' k x >>= getString k
95+
9396 applyElem (If k t mf) = (context' k x >> go t) `catchError` handler
9497 where
9598 handler _ = case mf of
9699 Nothing -> return ""
97100 Just f -> go f
101+
98102 applyElem (For k b s) = context' k x >>= \cf -> case cf of
99103 StringField _ -> fail $
100104 "Hakyll.Web.Template.applyTemplateWith: expected ListField but " ++
@@ -104,6 +108,10 @@ applyTemplate' tpl context x = go tpl
104108 bs <- mapM (applyTemplate' b c) xs
105109 return $ intercalate sep bs
106110
111+ applyElem (Partial p) = do
112+ tpl' <- loadBody (fromFilePath p)
113+ applyTemplate' tpl' context x
114+
107115 getString _ (StringField s) = return s
108116 getString k (ListField _ _) = fail $
109117 "Hakyll.Web.Template.applyTemplateWith: expected StringField but " ++