hakyll-4.12.0.1: A static website compiler library

Safe HaskellNone
LanguageHaskell2010

Hakyll.Web.Template.Internal

Synopsis

Documentation

newtype Template Source #

Datatype used for template substitutions.

Constructors

Template 

template :: [TemplateElement] -> Template Source #

Wrap the constructor to ensure trim is called.

templateBodyCompiler :: Compiler (Item Template) Source #

Read a template, without metadata header

templateCompiler :: Compiler (Item Template) Source #

Read complete file contents as a template

applyTemplate Source #

Arguments

:: Template

Template

-> Context a

Context

-> Item a

Page

-> Compiler (Item String)

Resulting item

applyTemplate' Source #

Arguments

:: [TemplateElement]

Unwrapped Template

-> Context a

Context

-> Item a

Page

-> Compiler String

Resulting item

loadAndApplyTemplate Source #

Arguments

:: Identifier

Template identifier

-> Context a

Context

-> Item a

Page

-> Compiler (Item String)

Resulting item

The following pattern is so common:

tpl <- loadBody "templates/foo.html"
someCompiler
    >>= applyTemplate tpl context

That we have a single function which does this:

someCompiler
    >>= loadAndApplyTemplate "templates/foo.html" context

applyAsTemplate Source #

Arguments

:: Context String

Context

-> Item String

Item and template

-> Compiler (Item String)

Resulting item

It is also possible that you want to substitute $key$s within the body of an item. This function does that by interpreting the item body as a template, and then applying it to itself.