@@ -1,12 +1,16 @@
1−module Text.Hakyll.CustomPage
1+module Text.Hakyll.Renderables
22 ( CustomPage,
3− createCustomPage
3+ createCustomPage,
4+ PagePath,
5+ createPagePath
46 ) where
57
68import System.FilePath
79import qualified Data.ByteString.Lazy.Char8 as B
810import qualified Data.Map as M
911import Control.Monad
12+import Text.Hakyll.Util
13+import Text.Hakyll.Page
1014import Text.Hakyll.Renderable
1115
1216data CustomPage = CustomPage { url :: String,
@@ -27,3 +31,14 @@ instance Renderable CustomPage where
2731 values <- mapM (either (return . B.pack) (>>= return) . snd) (mapping page)
2832 let keys = map (B.pack . fst) (mapping page)
2933 return $ M.fromList $ (B.pack "url", B.pack $ url page) : zip keys values
34+
35+data PagePath = PagePath FilePath
36+
37+createPagePath :: FilePath -> PagePath
38+createPagePath = PagePath
39+
40+-- We can render filepaths
41+instance Renderable PagePath where
42+ getDependencies (PagePath path) = return path
43+ getURL (PagePath path) = toURL path
44+ toContext (PagePath path) = readPage path >>= toContext