@@ -0,0 +1,77 @@
2+title: Hakyll 3 to Hakyll 4 migration guide
3+author: Jasper Van der Jeugt
9+This tutorial gives a quick overview on how you can port your blog/website from
10+Hakyll 3.X to Hakyll 4. A lot of changes have happened, so it might be useful to
11+read through the [tutorial series](/tutorials.html) before porting your website.
16+In Hakyll 3.X, `Compiler` was an instance of `Arrow`. Since Hakyll 4, `Compiler`
17+is a `Monad`. This means that previous chains such as:
20+compile $ someCompiler
21+ >>> someOtherCompiler
25+Now take the general form of:
28+compile $ someCompiler
29+ >>= someOtherCompiler
36+The `Page` type in Hakyll 3.X has been removed and replaced by an `Item` type.
37+`pageCompiler` no longer exists -- where you previously used this, you probably
38+want to use `pandocCompiler` instead.
40+`Page`s where manipulated using `setField`/`getField` functions in Hakyll 3.X.
41+In Hakyll 4, all metadata is completely immutable, so these functions have been
42+removed. In order to format and add fields, use a `Context` -- see the next
48+The template format has become slightly more flexible, whereas in Hakyll 3.X
49+only keys such as this were allowed:
55+we now allow arbitrary strings. This will be really useful in the future.
58+<h1>$uppercase title$</h1>
61+Some template functions have been renamed:
63+- `applyTemplateCompiler` becomes: `loadAndApplyTemplate`
64+- `applySelf` becomes: `applyAsTemplate`
66+Instead of setting fields in a `Page` before applying a template, we now use a
67+`Context`. More information on context can be found in
68+[this tutorial](/tutorials/04-compilers.html). For migration, you basically want
69+to map every `setField` to a field in a `Context`.
74+For tags, the [Hakyll.Web.Tags] module still provides a solution. In other
75+cases, the `preprocess` function should be able to compensate for this.
77+[Hakyll.Web.Tags]: /reference/Hakyll-Web-Tags.html