summaryrefslogtreecommitdiff
path: root/src/Text/Hakyll
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text/Hakyll')
-rw-r--r--src/Text/Hakyll/Hakyll.hs2
-rw-r--r--src/Text/Hakyll/Page.hs6
2 files changed, 3 insertions, 5 deletions
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.