diff options
author | Jasper Van der Jeugt <m@jaspervdj.be> | 2013-02-14 10:08:21 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <m@jaspervdj.be> | 2013-02-14 10:08:21 +0100 |
commit | 61dcb5f454fcbd912b09839021f4c79ca60973fe (patch) | |
tree | 37b39b20bc3f5325d2c13939c03ce286162eb354 /web/tutorials/04-compilers.markdown | |
parent | 2912fcd521d0d9fbe93dae37783f5f379893ddb1 (diff) | |
parent | 02a92d54cdee8299aac0f55cbe4a930ac5060d20 (diff) | |
download | hakyll-61dcb5f454fcbd912b09839021f4c79ca60973fe.tar.gz |
Merge branch 'master' into dev-metadata-route
Diffstat (limited to 'web/tutorials/04-compilers.markdown')
-rw-r--r-- | web/tutorials/04-compilers.markdown | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/web/tutorials/04-compilers.markdown b/web/tutorials/04-compilers.markdown index ef2877b..522f817 100644 --- a/web/tutorials/04-compilers.markdown +++ b/web/tutorials/04-compilers.markdown @@ -41,9 +41,11 @@ Templates Let's have a look at a simple template: - <h1>$title$</h1> - <div class="info">Posted on $date$</div> - $body$ +```html +<h1>$title$</h1> +<div class="info">Posted on $date$</div> +$body$ +``` As you can probably guess, template files just contain text and only the `$` character has special meaning: text between dollar signs ("fields") is replaced @@ -53,7 +55,9 @@ use `$$`. You usually compile the templates from disk using the aptly named `templateCompiler`: - match "templates/*" $ compile templateCompiler +```haskell +match "templates/*" $ compile templateCompiler +``` Notice the lack of `route` here: this is because we don't need to write the templates to your `_site` folder, we just want to use them elsewhere. @@ -86,7 +90,7 @@ And `$title$` like this: ```haskell titleContext :: Context a -titleContext :: field "title" $ \item -> do +titleContext = field "title" $ \item -> do metadata <- getMetadata (itemIdentifier item) return $ fromMaybe "No title" $ M.lookup "title" metadata ``` |