diff options
author | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2017-01-17 13:23:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-17 13:23:21 +0100 |
commit | 06508151275f7a9ad785b5566093351dd741dc1f (patch) | |
tree | 0c096935d98d5f29a24ab8321afa562090c270a6 /web/tutorials | |
parent | 9770dd98b09155e6e5d043eb886f4dff0c889aa8 (diff) | |
parent | 7558a4c73dc2042a8eebd545805077ecceb7ca69 (diff) | |
download | hakyll-06508151275f7a9ad785b5566093351dd741dc1f.tar.gz |
Merge pull request #512 from beerendlauwers/patch-2
Added information about the separator functionality in $for$.
Diffstat (limited to 'web/tutorials')
-rw-r--r-- | web/tutorials/04-compilers.markdown | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/web/tutorials/04-compilers.markdown b/web/tutorials/04-compilers.markdown index a9423dc..deb07f9 100644 --- a/web/tutorials/04-compilers.markdown +++ b/web/tutorials/04-compilers.markdown @@ -236,6 +236,20 @@ This uses the `$for(foo)$` construct. This construct allows you loop over a list, in this case, `$posts$`. Inside the body of this for loop, all fields refer to the current post, e.g.: `$url$`, `$title$` and `$date$`. +You can also add a simple separator with the special `$sep$` field. +Everything between `$sep$` and `$endfor$` will be regarded as a separator +that will only be shown if there is more than one item in the list. + +```html +<ul> + $for(posts)$ + $x$ + $sep$, + $endfor$ +</ul> +``` + + Of course, $posts$ does not magically appear. We have to specify this in `site.hs`. Let's look at how `archive.html` is generated: |