summaryrefslogtreecommitdiff
path: root/web/tutorials
diff options
context:
space:
mode:
Diffstat (limited to 'web/tutorials')
-rw-r--r--web/tutorials/02-basics.markdown2
-rw-r--r--web/tutorials/03-compilers.markdown33
2 files changed, 29 insertions, 6 deletions
diff --git a/web/tutorials/02-basics.markdown b/web/tutorials/02-basics.markdown
index b4c5e22..46d85a6 100644
--- a/web/tutorials/02-basics.markdown
+++ b/web/tutorials/02-basics.markdown
@@ -99,6 +99,8 @@ some common examples:
- `copyFileCompiler` is self-explanatory, the output is exactly the same as the
input;
+- `getResourceBody` just gets you the content as a `String`, so you can perform
+ other manipulations afterwards;
- `compressCssCompiler` performs some simple build-in compression
transformations for CSS;
- `pandocCompiler` reads markdown, reStructuredText, or another input format and
diff --git a/web/tutorials/03-compilers.markdown b/web/tutorials/03-compilers.markdown
index 59fa0da..953464f 100644
--- a/web/tutorials/03-compilers.markdown
+++ b/web/tutorials/03-compilers.markdown
@@ -1,12 +1,33 @@
---
-title: Using and writing Compilers
+title: More on compilers: load, and templates
author: Jasper Van der Jeugt
---
-Identifier, Item, Compiler
---------------------------
+Loading items
+-------------
-Three important, related types are `Identifier`, `Item` and `Compiler`.
+The compiler Monad is a complex beast, but this is nicely hidden for the user of
+the Hakyll library.
-- `Identifier` is a string-like value which uniquely identifies a single item
- for your webpage
+Suppose that you're generating `index.html` which shows your latest brilliant
+blogpost. This requires `posts/foo.markdown` to be generated *before*
+`index.html` (so we don't have to generate it twice). But you don't have to care
+about all of that: Hakyll will sort this out this out for you automatically!
+
+Let's see some quick examples. We can load a specific item:
+
+```haskell
+load "posts/foo.markdown" :: Compiler (Item String)
+```
+
+Or a whole bunch of them:
+
+```haskell
+loadAll "posts/*" :: Compiler [Item String]
+```
+
+Sometimes you just want the *contents* and not the `Item`:
+
+```haskell
+loadBody "posts/foo.markdown" :: Compiler String
+```