@@ -0,0 +1,31 @@
1+-- | A page is an important concept in Hakyll: it has a body (usually of the
2+-- type 'String') and number of metadata fields. This type is used to represent
3+-- pages on your website.
11+import qualified Data.Map as M
13+import Hakyll.Core.Writable
15+-- | Type used to represent pages
18+ { pageMetadata :: Map String String
22+instance Functor Page where
23+ fmap f (Page m b) = Page m (f b)
25+instance Writable a => Writable (Page a) where
26+ write p (Page _ b) = write p b
28+-- | Convert a page to a map. The body will be placed in the @body@ key.
30+toMap :: Page String -> Map String String
31+toMap (Page m b) = M.insert "body" b m