-
Notifications
You must be signed in to change notification settings - Fork 1
/
Archives.hs
34 lines (27 loc) · 964 Bytes
/
Archives.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{-# LANGUAGE OverloadedStrings #-}
module Debiania.Archives (
archivesRules
) where
import Hakyll
import Debiania.Compilers
import Debiania.Context
archivesRules :: Rules ()
archivesRules = do
create ["posts.markdown"] $ do
route $ setExtension "html"
compile $ do
-- First of all, load all the posts
posts <- loadAll ("posts/*" .&&. hasNoVersion)
yearsCtx <- makeYearsCtx posts
makeItem ("" :: String)
>>= loadAndApplyTemplate "templates/archives.html" yearsCtx
>>= loadAndApplyTemplate
"templates/default.html"
( constField "title" "Archives"
<> constField "navbar-archives" "Yep"
<> rootUrlCtx
<> defaultContext)
>>= relativizeUrls
create ["posts.markdown"] $ version "gzipped" $ do
route $ setExtension "html.gz"
compile gzipFileCompiler