summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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.