@@ -124,11 +124,10 @@ readPageFromFile path = do
124124
125125 -- Read file.
126126 contents <- liftIO $ readFile path
127− enableCategories' <- askHakyll enableCategories
128127 let sections = splitAtDelimiters $ lines contents
129128 context = concat $ zipWith ($) sectionFunctions sections
130129 page = fromContext $ M.fromList $
131− [ ("category", getCategory path) | enableCategories' ] ++
130+ category ++
132131 [ ("url", url)
133132 , ("path", path)
134133 ] ++ context
@@ -136,7 +135,8 @@ readPageFromFile path = do
136135 return page
137136 where
138137 url = toURL path
139− getCategory = last . splitDirectories . takeDirectory
138+ category = let dirs = splitDirectories $ takeDirectory path
139+ in [("category", last dirs) | not (null dirs)]
140140
141141-- | Read a page. Might fetch it from the cache if available. Otherwise, it will
142142-- read it from the file given and store it in the cache.