Adds series functionality to hakyll.
Module for adding series functionality to hakyll.
Example here.
In your posts, provide metadata at the top like so:
---
title: something
series: things
---This will add the following fields to the post:
seriesThe name of the series
seriesLengthThe total number of posts in the series
seriesCurPosThe position of the current post in the series
seriesUrlThe URL of the series page
Using that, in your post template, something like this:
$if(series)$
    <a href="$seriesUrl$">Part $seriesCurPos$ of a $seriesLength$-part series on $series$</a>
$endif$Will render like this:
Part 1 of a 5-part series on thingsLinked to the aggregate page for the series, which would render something like this:
Things
Part 1: somethingTo add it to your blog, add something like this to your main:
series <- buildSeries "posts/*" (fromCapture "series/*.html")
tagsRules series $ \(s:erie) pattrn -> do
    let title = toUpper s : erie
    route idRoute
    compile $ do
        posts <- chronological =<< loadAll pattrn
        let ctx = constField "title" title `mappend`
                  listField "posts" postCtx (pure posts) `mappend`
                  defaultContext
        makeItem ""
            >>= loadAndApplyTemplate "templates/series.html" ctx
            >>= loadAndApplyTemplate "templates/default.html" ctx
            >>= relativizeUrlsTo have access to the series context in each post, change the post rule to something like this:
match "posts/*" $ do
    route $ setExtension "html"
    compile $ pandocCompiler
        >>= loadAndApplyTemplate "templates/post.html"    (postCtxWithSeries series)
        >>= loadAndApplyTemplate "templates/default.html" (postCtxWithSeries series)
        >>= relativizeUrlsWhere postCtxWithSeries can be something like:
postCtxWithSeries :: Tags -> Context String
postCtxWithSeries series = seriesField series `mappend` postCtxA minimal example is provided in this repo, on top of the default hakyll setup. (it also provides the templates)