Fork me on GitHub

Tutorial: Installation

Installation

Installation is provided via Hackage, and some packages are available for different distributions. For installation from source (i.e. via Hackage), stack is recommended:

$ stack install hakyll

Linux distro packages:

Building the example site

Apart from the main Hakyll library, the cabal package also provides you with an executable hakyll-init to create an example site. This is an easy way to get started:

$ hakyll-init my-site

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 your stack bin path (usually $HOME/.local/bin) is in your $PATH. You can check your stack local bin path by running stack path --local-bin.

The file site.hs holds the configuration of your site, as an executable haskell program. We can compile and run it like this:

$ cd my-site
$ stack init  # creates stack.yaml file based on my-site.cabal
$ stack build
$ stack exec site build

If you installed hakyll with a preview server (this is the default), you can now use

$ stack exec site watch

and have a look at your site at http://localhost:8000/.

Other tutorials

The other tutorials can be found here.

Documentation inaccurate or out-of-date? Found a typo?

Hakyll is an open source project, and one of the hardest parts is writing correct, up-to-date, and understandable documentation. Therefore, the authors would really appreciate it if you would give feedback about the tutorials, and especially report errors or difficulties you encountered. If you have a github account, you can use the issue system. Thanks! If you run into any problems, all questions are welcome in the above google group, or you could try the IRC channel, #hakyll on freenode.