A module that provides different ways to create a Context
. These
functions all use the HakyllAction
arrow, so they produce values of the
type HakyllAction () Context
.
- createPage :: FilePath -> HakyllAction () Context
- createCustomPage :: FilePath -> [(String, Either String (HakyllAction () String))] -> HakyllAction () Context
- createListing :: FilePath -> [FilePath] -> [HakyllAction () Context] -> [(String, Either String (HakyllAction () String))] -> HakyllAction () Context
- addField :: String -> Either String (HakyllAction () String) -> HakyllAction Context Context
- combine :: HakyllAction () Context -> HakyllAction () Context -> HakyllAction () Context
- combineWithUrl :: FilePath -> HakyllAction () Context -> HakyllAction () Context -> HakyllAction () Context
Documentation
createPage :: FilePath -> HakyllAction () ContextSource
Create a Context
from a page file stored on the disk. This is probably
the most common way to create a Context
.
createCustomPage :: FilePath -> [(String, Either String (HakyllAction () String))] -> HakyllAction () ContextSource
Create a custom page Context
.
The association list given maps keys to values for substitution. Note
that as value, you can either give a String
or a
HakyllAction () String
. The latter is preferred for more complex data,
since it allows dependency checking. A String
is obviously more simple
to use in some cases.
:: FilePath | Destination of the page. |
-> [FilePath] | Templates to render items with. |
-> [HakyllAction () Context] | Renderables in the list. |
-> [(String, Either String (HakyllAction () String))] | |
-> HakyllAction () Context |
A createCustomPage
function specialized in creating listings.
This function creates a listing of a certain list of Context
s. Every
item in the list is created by applying the given template to every
renderable. You can also specify additional context to be included in the
CustomPage
.
:: String | Key |
-> Either String (HakyllAction () String) | Value |
-> HakyllAction Context Context | Result |
Add a field to a Context
.
combine :: HakyllAction () Context -> HakyllAction () Context -> HakyllAction () ContextSource
Combine two Context
s. The url will always be taken from the first
Renderable
. Also, if a `$key` is present in both renderables, the
value from the first Context
will be taken as well.
You can see this as a this as a union
between two mappings.
combineWithUrl :: FilePath -> HakyllAction () Context -> HakyllAction () Context -> HakyllAction () ContextSource
Combine two Context
s and set a custom URL. This behaves like combine
,
except that for the url
field, the given URL is always chosen.