@@ -2,7 +2,8 @@ module Text.Hakyll.Page
3 fromContext,
3 fromContext,
8import qualified Data.Map as M
9import qualified Data.Map as M
@@ -116,6 +117,13 @@ readPage pagePath = do
116 where url = toURL pagePath
117 where url = toURL pagePath
117 cacheFile = toCache url
118 cacheFile = toCache url
120+-- | Write a page to the site destination.
121+writePage :: Page -> IO ()
123+ let destination = toDestination $ getURL page
124+ makeDirectories destination
125+ B.writeFile destination (getBody page)
119-- Make pages renderable.
127-- Make pages renderable.
120instance Renderable Page where
128instance Renderable Page where
121 getDependencies = (:[]) . flip addExtension ".html" . dropExtension . getPageURL
129 getDependencies = (:[]) . flip addExtension ".html" . dropExtension . getPageURL