summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Hakyll/Web.hs21
-rw-r--r--src/Hakyll/Web/Page.hs2
2 files changed, 22 insertions, 1 deletions
diff --git a/src/Hakyll/Web.hs b/src/Hakyll/Web.hs
new file mode 100644
index 0000000..bc7710f
--- /dev/null
+++ b/src/Hakyll/Web.hs
@@ -0,0 +1,21 @@
+-- | Module exporting commonly used web-related functions
+--
+module Hakyll.Web
+ ( defaultPageRead
+ , defaultTemplateRead
+ ) where
+
+import Control.Arrow (arr, (>>>), (>>^))
+
+import Hakyll.Core.Compiler
+import Hakyll.Web.Page
+import Hakyll.Web.Pandoc
+import Hakyll.Web.Template
+
+defaultPageRead :: Compiler () (Page String)
+defaultPageRead = cached "Hakyll.Web.defaultPageRead" $
+ pageRead >>> addDefaultFields >>> arr applySelf >>> pageRenderPandoc
+
+defaultTemplateRead :: Compiler () Template
+defaultTemplateRead = cached "Hakyll.Web.defaultTemplateRead" $
+ getResourceString >>^ readTemplate
diff --git a/src/Hakyll/Web/Page.hs b/src/Hakyll/Web/Page.hs
index 6fed202..9294231 100644
--- a/src/Hakyll/Web/Page.hs
+++ b/src/Hakyll/Web/Page.hs
@@ -61,6 +61,6 @@ addDefaultFields = (getRoute &&& id >>^ uncurry addRoute)
-- Add title and category, based on identifier
addIdentifier i = addField "title" (takeBaseName p)
- . addField "category" (takeBaseName $ takeDirectory p)
+ . addField "category" (takeBaseName $ takeDirectory p)
where
p = toFilePath i