hakyll/web/tutorials/a-guide-to-the-hakyll-module-zoo.markdown
Jasper Van der Jeugt f2905021ec Add a clay tutorial
2013-01-13 12:36:45 +01:00

3.4 KiB

title author
A Guide to the Hakyll Module Zoo Brent Yorgey

The hakyll package contains a bewildering array of modules, and it's hard to know where to look when you are just getting started -- especially since many of them are mostly just used by Hakyll internally and not that useful to website authors. This guide provides a quick reference to the contents of the most important and useful modules.

Core modules

These are the modules containing the fundamental tools and concepts you need to get started building a site with hakyll.

  • Hakyll.Core.Compiler

    This is one of the modules you should look at first. It defines the fundamental Compiler type and primitive Compilers as well as several variants on load, which allow you to bring together multiple resources to create a single output.

  • Hakyll.Core.Routes

    Specify where compiled items should go in the output site.

  • Hakyll.Core.Rules

    Specify which compilers and routes should be used on which resources. Also has combinators for versions (necessary if you want to use the same resources for multiple purposes).

  • Hakyll.Core.Identifier.Pattern

    Combinators for creating patterns, i.e. predicates that pick out a set of resources: filesystem globs, explicit lists, regular expressions, and so on.

  • Hakyll.Web.Page

    Provides functions for rendering your pages using pandoc, with a varying degree of high-levelness.

  • Hakyll.Web.Template

    Templates specify how to take the content of an item and turn it into HTML output.

  • Hakyll.Web.Template.Context

    You can't do much with a Template if you don't have a Context: this module provides some predefined Contexts and the tools to build your own.

  • Hakyll.Main

    The main hakyll function that runs the whole show. There is also a hakyllWith function which allows for a custom configuration.

Pre-packaged solutions

These modules contain some "pre-packaged" solutions for common situations. They can be used as-is, or their source can be used as inspiration for your own tools.

Useful utilities

Advanced customization

  • Hakyll.Core.Writable

    The Writable class is for resources which can be written to disk as part of the output site. You can specify how to write your own custom types to disk by giving them a Writable instance.