@@ -52,27 +52,45 @@ renderWith manipulation templatePath renderable = do
5252 context <- toContext renderable
5353 return $ fromContext $ pureRenderWith manipulation template context
5454
55−-- | Render each renderable with the given template, then concatenate the
56−-- result.
57−renderAndConcat :: Renderable a => FilePath -> [a] -> Hakyll String
55+-- | Render each renderable with the given templates, then concatenate the
56+-- result. So, basically this function:
57+--
58+-- * Takes every renderable.
59+--
60+-- * Renders every renderable with all given templates. This is comparable
61+-- with a renderChain action.
62+--
63+-- * Concatenates the result.
64+--
65+renderAndConcat :: Renderable a
66+ => [FilePath] -- ^ Templates to apply on every renderable.
67+ -> [a] -- ^ Renderables to render.
68+ -> Hakyll String
5869renderAndConcat = renderAndConcatWith id
5970
60−-- | Render each renderable with the given template, then concatenate the
71+-- | Render each renderable with the given templates, then concatenate the
6172-- result. This function allows you to specify a "ContextManipulation" to
6273-- apply on every "Renderable".
6374renderAndConcatWith :: Renderable a
6475 => ContextManipulation
65− -> FilePath
76+ -> [FilePath]
6677 -> [a]
6778 -> Hakyll String
68−renderAndConcatWith manipulation templatePath renderables = do
69− template <- liftIO $ readFile templatePath
79+renderAndConcatWith manipulation templatePaths renderables = do
80+ templates <- liftIO $ mapM readFile templatePaths
7081 contexts <- mapM toContext renderables
71− return $ pureRenderAndConcatWith manipulation template contexts
82+ return $ pureRenderAndConcatWith manipulation templates contexts
7283
7384-- | Chain a render action for a page with a number of templates. This will
7485-- also write the result to the site destination. This is the preferred way
7586-- to do general rendering.
87+--
88+-- > renderChain [ "templates/notice.html"
89+-- > , "templates/default.html"
90+-- > ] $ createPagePath "warning.html"
91+--
92+-- This code will first render @warning.html@ using @templates/notice.html@,
93+-- and will then render the result with @templates/default.html@.
7694renderChain :: Renderable a => [FilePath] -> a -> Hakyll ()
7795renderChain = renderChainWith id
7896