@@ -1,12 +1,16 @@
1−module Text.Hakyll.CustomPage
1+module Text.Hakyll.Renderables
2 ( CustomPage,
2 ( CustomPage,
3− createCustomPage
3+ createCustomPage,
6import System.FilePath
8import System.FilePath
7import qualified Data.ByteString.Lazy.Char8 as B
9import qualified Data.ByteString.Lazy.Char8 as B
8import qualified Data.Map as M
10import qualified Data.Map as M
9import Control.Monad
11import Control.Monad
12+import Text.Hakyll.Util
13+import Text.Hakyll.Page
10import Text.Hakyll.Renderable
14import Text.Hakyll.Renderable
12data CustomPage = CustomPage { url :: String,
16data CustomPage = CustomPage { url :: String,
@@ -27,3 +31,14 @@ instance Renderable CustomPage where
27 values <- mapM (either (return . B.pack) (>>= return) . snd) (mapping page)
31 values <- mapM (either (return . B.pack) (>>= return) . snd) (mapping page)
28 let keys = map (B.pack . fst) (mapping page)
32 let keys = map (B.pack . fst) (mapping page)
29 return $ M.fromList $ (B.pack "url", B.pack $ url page) : zip keys values
33 return $ M.fromList $ (B.pack "url", B.pack $ url page) : zip keys values
35+data PagePath = PagePath FilePath
37+createPagePath :: FilePath -> PagePath
38+createPagePath = PagePath
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