hakyll-2.0: A simple static site generator library.Source codeContentsIndex
This module exports a number of functions that produce HakyllActions to manipulate Contexts.
renderValue :: String -> String -> (String -> String) -> HakyllAction Context Context
changeValue :: String -> (String -> String) -> HakyllAction Context Context
copyValue :: String -> String -> HakyllAction Context Context
renderDate :: String -> String -> String -> HakyllAction Context Context
changeExtension :: String -> HakyllAction Context Context
renderBody :: (String -> String) -> HakyllAction Context Context
:: StringKey of which the value should be copied.
-> StringKey the value should be copied to.
-> (String -> String)Function to apply on the value.
-> HakyllAction Context Context
Do something with a value in a Context, but keep the old value as well. If the key given is not present in the Context, nothing will happen.
:: StringKey to change.
-> (String -> String)Function to apply on the value.
-> HakyllAction Context Context

Change a value in a Context.

 import Data.Char (toUpper)
 changeValue "title" (map toUpper)

Will put the title in UPPERCASE.

:: StringSource key.
-> StringDestination key.
-> HakyllAction Context Context
Copy a value from one key to another in a Context.
:: StringKey in which the rendered date should be placed.
-> StringFormat to use on the date.
-> StringDefault key, in case the date cannot be parsed.
-> HakyllAction Context Context

When the context has a key called path in a folder/yyyy-mm-dd-title.extension format (the convention for pages), this function can render the date.

 renderDate "date" "%B %e, %Y" "Date unknown"

Will render something like January 32, 2010.

:: StringExtension to change to.
-> HakyllAction Context Context

Change the extension of a file. This is only needed when you want to render, for example, mardown to .php files instead of .html files.

 changeExtension "php"

Will render test.markdown to test.php instead of test.html.

renderBody :: (String -> String) -> HakyllAction Context ContextSource

Change the body of a file using a certain manipulation.

 import Data.Char (toUpper)
 renderBody (map toUpper)

Will put the entire body of the page in UPPERCASE.

Produced by Haddock version 2.7.2