summaryrefslogtreecommitdiff
path: root/src/Hakyll
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2011-06-16 08:50:48 +0200
committerJasper Van der Jeugt <jaspervdj@gmail.com>2011-06-16 08:50:48 +0200
commit307eaf160e9b45f86fc27afb4c71c82d7721ca19 (patch)
tree572b8b90a7dc12600a09d138988e47b163f47ced /src/Hakyll
parent0fe7e12fe6a6cbc0fe56a18e857089d4d7343a12 (diff)
downloadhakyll-307eaf160e9b45f86fc27afb4c71c82d7721ca19.tar.gz
The "premade configs" belong in another package
Diffstat (limited to 'src/Hakyll')
-rw-r--r--src/Hakyll/Configs/SmallBlog.hs101
1 files changed, 0 insertions, 101 deletions
diff --git a/src/Hakyll/Configs/SmallBlog.hs b/src/Hakyll/Configs/SmallBlog.hs
deleted file mode 100644
index eebd437..0000000
--- a/src/Hakyll/Configs/SmallBlog.hs
+++ /dev/null
@@ -1,101 +0,0 @@
--- | This module provides a simple default configuration which behaves similar
--- to the Jekyll static site generator.
---
--- <http://jekyllrb.com/>
---
--- The idea is that you don't have to write your configuration yourself: you
--- just follow some conventions, and Hakyll does the rest.
---
-{-# LANGUAGE OverloadedStrings #-}
-{-# OPTIONS_GHC -fno-warn-unused-do-bind #-}
-module Hakyll.Configs.SmallBlog
- ( SmallBlogConfiguration
- , defaultSmallBlogConfiguration
- , smallBlog
- , smallBlogWith
- ) where
-
-import Control.Arrow ((>>>))
-
-import Hakyll
-
--- | Configuration datatype for the 'smallBlog' ruleset
---
-data SmallBlogConfiguration = SmallBlogConfiguration
- { -- | Number of recent posts that are available
- numberOfRecentPosts :: Int
- } deriving (Show)
-
--- | Defaults for 'SmallBlogConfiguration'
---
-defaultSmallBlogConfiguration :: SmallBlogConfiguration
-defaultSmallBlogConfiguration = SmallBlogConfiguration
- { numberOfRecentPosts = 3
- }
-
--- | A default configuration for a small blog
---
-smallBlog :: Rules
-smallBlog = smallBlogWith defaultSmallBlogConfiguration
-
--- | Version of 'smallBlog' which allows setting a config
---
-smallBlogWith :: SmallBlogConfiguration -> Rules
-smallBlogWith conf = do
- -- Images and static files
- ["favicon.ico"] --> copy
- ["img/**", "images/**"] --> copy
- ["static/**", "files/**"] --> copy
- ["js/**"] --> copy
-
- -- CSS files
- ["css/*.css", "style/*.css", "stylesheets/*.css"] --> css
-
- -- All templates
- ["templates/*"] --> template
-
- -- "Dynamic" content
- ["posts/*"] --> post
-
- -- Top-level pages
- ["*.markdown", "*.html", "*.rst", "*.lhs"] --> topLevel
- where
- -- Useful combinator here
- xs --> f = mapM_ (\p -> match p $ f) xs
-
- -- Completely static
- copy = route idRoute >> compile copyFileCompiler
-
- -- CSS directories
- css = route (setExtension "css") >> compile compressCssCompiler
-
- -- Templates
- template = compile templateCompiler
-
- -- Posts
- post = do
- route $ setExtension "html"
- compile $ pageCompiler
- >>> applyTemplateCompiler "templates/post.html"
- >>> applyTemplateCompiler "templates/default.html"
- >>> relativizeUrlsCompiler
-
- -- Top-level pages
- topLevel = do
- route $ setExtension "html"
- compile $ pageCompilerWithFields defaultHakyllParserState
- defaultHakyllWriterOptions id topLevelFields
- >>> applyTemplateCompiler "templates/default.html"
- >>> relativizeUrlsCompiler
-
- -- Add the fields we need to top-level pages
- topLevelFields = setFieldPostList recentFirst "allPosts"
- >>> setFieldPostList (take nRecent . recentFirst) "recentPosts"
- >>> setFieldPostList chronological "chronologicalPosts"
-
- -- Create a post list based on ordering/selection
- setFieldPostList f k = setFieldPageList f
- "templates/post-item.html" k "posts/*"
-
- -- Number of most recent posts to show
- nRecent = numberOfRecentPosts conf