summaryrefslogtreecommitdiff
path: root/web/tutorials
diff options
context:
space:
mode:
authorJasper Van der Jeugt <m@jaspervdj.be>2013-02-14 10:08:21 +0100
committerJasper Van der Jeugt <m@jaspervdj.be>2013-02-14 10:08:21 +0100
commit61dcb5f454fcbd912b09839021f4c79ca60973fe (patch)
tree37b39b20bc3f5325d2c13939c03ce286162eb354 /web/tutorials
parent2912fcd521d0d9fbe93dae37783f5f379893ddb1 (diff)
parent02a92d54cdee8299aac0f55cbe4a930ac5060d20 (diff)
downloadhakyll-61dcb5f454fcbd912b09839021f4c79ca60973fe.tar.gz
Merge branch 'master' into dev-metadata-route
Diffstat (limited to 'web/tutorials')
-rw-r--r--web/tutorials/01-installation.markdown5
-rw-r--r--web/tutorials/03-rules-routes-compilers.markdown2
-rw-r--r--web/tutorials/04-compilers.markdown14
-rw-r--r--web/tutorials/faq.markdown14
4 files changed, 26 insertions, 9 deletions
diff --git a/web/tutorials/01-installation.markdown b/web/tutorials/01-installation.markdown
index 1a48013..2066886 100644
--- a/web/tutorials/01-installation.markdown
+++ b/web/tutorials/01-installation.markdown
@@ -32,8 +32,9 @@ started:
$ hakyll-init my-site
-If `hakyll-init` is not found, you should make sure `$HOME/.cabal/bin` is in
-your `$PATH`.
+This creates a folder `my-site` in the current directory, with some example
+content and a generic configuration. If `hakyll-init` is not found, you should
+make sure `$HOME/.cabal/bin` is in your `$PATH`.
The file `site.hs` holds the configuration of your site, as an executable
haskell program. We can compile and run it like this:
diff --git a/web/tutorials/03-rules-routes-compilers.markdown b/web/tutorials/03-rules-routes-compilers.markdown
index d587ab4..fbaa377 100644
--- a/web/tutorials/03-rules-routes-compilers.markdown
+++ b/web/tutorials/03-rules-routes-compilers.markdown
@@ -61,7 +61,7 @@ this will become clear soon. The real question here is why we use `create`
instead of `match`.
The answer is simple: there is no `archive.html` file in our project directory!
-So if we were to use `match`, no a file would be matched, and hence, nothing
+So if we were to use `match`, no file would be matched, and hence, nothing
would appear in the output directory. `create`, however, ensures the items
listed are always produced.
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
```
diff --git a/web/tutorials/faq.markdown b/web/tutorials/faq.markdown
index c0bbd3f..63f310f 100644
--- a/web/tutorials/faq.markdown
+++ b/web/tutorials/faq.markdown
@@ -31,13 +31,25 @@ recent version of Pandoc (1.9 and onwards). Note that you also need to include
some CSS in order for this to work! This site, for example, uses the [default
Pandoc syntax CSS file][syntax-css].
+To highlight a code block, you need to use Pandoc's fenced code block syntax to
+set the block's language. For example, here's how you highlight Haskell code:
+
+ ``` haskell
+ fac n = foldr (*) 1 [1..n]
+ ```
+
+For details, see Pandoc's user guide on [fenced code
+blocks][pandoc-code-blocks] and [inline code][pandoc-inline-code].
+
[syntax-css]: https://github.com/jaspervdj/hakyll/blob/master/web/css/syntax.css
+[pandoc-code-blocks]: http://johnmacfarlane.net/pandoc/README.html#fenced-code-blocks
+[pandoc-inline-code]: http://johnmacfarlane.net/pandoc/README.html#verbatim
## When should I rebuild and when should I build?
If you execute a `./site build`, Hakyll will build your site incrementally.
However, we can not detect if you edited `site.hs`. In this case, you first want
-to compile it again `site.hs` again, and then do a `./site rebuild`.
+to compile `site.hs` again, and then do a `./site rebuild`.
After rebuilding your site, all files will look as "modified" to the filesystem.
This means that when you upload your site, it will usually transfer all files --