@@ -1,101 +0,0 @@
1−-- | This module provides a simple default configuration which behaves similar
2−-- to the Jekyll static site generator.
4−-- <http://jekyllrb.com/>
6−-- The idea is that you don't have to write your configuration yourself: you
7−-- just follow some conventions, and Hakyll does the rest.
9−{-# LANGUAGE OverloadedStrings #-}
10−{-# OPTIONS_GHC -fno-warn-unused-do-bind #-}
11−module Hakyll.Configs.SmallBlog
12− ( SmallBlogConfiguration
13− , defaultSmallBlogConfiguration
18−import Control.Arrow ((>>>))
22−-- | Configuration datatype for the 'smallBlog' ruleset
24−data SmallBlogConfiguration = SmallBlogConfiguration
25− { -- | Number of recent posts that are available
26− numberOfRecentPosts :: Int
29−-- | Defaults for 'SmallBlogConfiguration'
31−defaultSmallBlogConfiguration :: SmallBlogConfiguration
32−defaultSmallBlogConfiguration = SmallBlogConfiguration
33− { numberOfRecentPosts = 3
36−-- | A default configuration for a small blog
39−smallBlog = smallBlogWith defaultSmallBlogConfiguration
41−-- | Version of 'smallBlog' which allows setting a config
43−smallBlogWith :: SmallBlogConfiguration -> Rules
44−smallBlogWith conf = do
45− -- Images and static files
46− ["favicon.ico"] --> copy
47− ["img/**", "images/**"] --> copy
48− ["static/**", "files/**"] --> copy
52− ["css/*.css", "style/*.css", "stylesheets/*.css"] --> css
55− ["templates/*"] --> template
61− ["*.markdown", "*.html", "*.rst", "*.lhs"] --> topLevel
63− -- Useful combinator here
64− xs --> f = mapM_ (\p -> match p $ f) xs
67− copy = route idRoute >> compile copyFileCompiler
70− css = route (setExtension "css") >> compile compressCssCompiler
73− template = compile templateCompiler
77− route $ setExtension "html"
78− compile $ pageCompiler
79− >>> applyTemplateCompiler "templates/post.html"
80− >>> applyTemplateCompiler "templates/default.html"
81− >>> relativizeUrlsCompiler
85− route $ setExtension "html"
86− compile $ pageCompilerWithFields defaultHakyllParserState
87− defaultHakyllWriterOptions id topLevelFields
88− >>> applyTemplateCompiler "templates/default.html"
89− >>> relativizeUrlsCompiler
91− -- Add the fields we need to top-level pages
92− topLevelFields = setFieldPostList recentFirst "allPosts"
93− >>> setFieldPostList (take nRecent . recentFirst) "recentPosts"
94− >>> setFieldPostList chronological "chronologicalPosts"
96− -- Create a post list based on ordering/selection
97− setFieldPostList f k = setFieldPageList f
98− "templates/post-item.html" k "posts/*"
100− -- Number of most recent posts to show
101− nRecent = numberOfRecentPosts conf