summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2010-01-28 13:00:23 +0100
committerJasper Van der Jeugt <jaspervdj@gmail.com>2010-01-28 13:00:23 +0100
commit0d2cfb08a777f3a6459c14e40a52633cb1a2aa90 (patch)
treee8895ceb369ffbfcb9cdae86d3dc576599d34312 /src
parenta600b84662d3224de5e0eb2458b3d54a618a3ace (diff)
downloadhakyll-0d2cfb08a777f3a6459c14e40a52633cb1a2aa90.tar.gz
Categories are more or less stable now.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Hakyll.hs1
-rw-r--r--src/Text/Hakyll/Hakyll.hs2
-rw-r--r--src/Text/Hakyll/Page.hs6
3 files changed, 3 insertions, 6 deletions
diff --git a/src/Text/Hakyll.hs b/src/Text/Hakyll.hs
index 0157f05..33b1b57 100644
--- a/src/Text/Hakyll.hs
+++ b/src/Text/Hakyll.hs
@@ -19,7 +19,6 @@ defaultHakyllConfiguration = HakyllConfiguration
{ additionalContext = M.empty
, siteDirectory = "_site"
, cacheDirectory = "_cache"
- , enableCategories = False
}
-- | Hakyll with a default configuration.
diff --git a/src/Text/Hakyll/Hakyll.hs b/src/Text/Hakyll/Hakyll.hs
index 3eb1e6b..b33bbda 100644
--- a/src/Text/Hakyll/Hakyll.hs
+++ b/src/Text/Hakyll/Hakyll.hs
@@ -19,8 +19,6 @@ data HakyllConfiguration = HakyllConfiguration
siteDirectory :: FilePath
, -- | Directory for cache files.
cacheDirectory :: FilePath
- -- | Use categories in addition to tags.
- , enableCategories :: Bool
}
-- | Our custom monad stack.
diff --git a/src/Text/Hakyll/Page.hs b/src/Text/Hakyll/Page.hs
index fb23d6f..39bb682 100644
--- a/src/Text/Hakyll/Page.hs
+++ b/src/Text/Hakyll/Page.hs
@@ -124,11 +124,10 @@ readPageFromFile path = do
-- Read file.
contents <- liftIO $ readFile path
- enableCategories' <- askHakyll enableCategories
let sections = splitAtDelimiters $ lines contents
context = concat $ zipWith ($) sectionFunctions sections
page = fromContext $ M.fromList $
- [ ("category", getCategory path) | enableCategories' ] ++
+ category ++
[ ("url", url)
, ("path", path)
] ++ context
@@ -136,7 +135,8 @@ readPageFromFile path = do
return page
where
url = toURL path
- getCategory = last . splitDirectories . takeDirectory
+ category = let dirs = splitDirectories $ takeDirectory path
+ in [("category", last dirs) | not (null dirs)]
-- | Read a page. Might fetch it from the cache if available. Otherwise, it will
-- read it from the file given and store it in the cache.