This module exports a number of functions that produce HakyllAction
s to
manipulate Context
s.
- renderValue :: String -> String -> (String -> String) -> HakyllAction Context Context
- changeValue :: String -> (String -> String) -> HakyllAction Context Context
- changeUrl :: (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
Documentation
:: String | Key of which the value should be copied. |
-> String | Key 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.
:: String | Key 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.
:: (String -> String) | Function to change URL with. |
-> HakyllAction Context Context | Resulting action. |
Change the URL of a page. This requires a special function, so dependency handling can happen correctly.
:: String | Source key. |
-> String | Destination key. |
-> HakyllAction Context Context |
Copy a value from one key to another in a Context
.
:: String | Key in which the rendered date should be placed. |
-> String | Format to use on the date. |
-> String | Default 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
.
:: String | Extension 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.