diff options
author | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2010-12-31 16:15:57 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2010-12-31 16:15:57 +0100 |
commit | e1aa9600993363eec55425bc05cb9813b9054f91 (patch) | |
tree | 72056e62e0f7059aa05335f64308f0b2559a8986 /src/Hakyll | |
parent | e54834f4448f4bcc6fb55fb338ffcfd4390fd356 (diff) | |
download | hakyll-e1aa9600993363eec55425bc05cb9813b9054f91.tar.gz |
Add Hakyll.Web module
Diffstat (limited to 'src/Hakyll')
-rw-r--r-- | src/Hakyll/Web.hs | 21 | ||||
-rw-r--r-- | src/Hakyll/Web/Page.hs | 2 |
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 |