diff options
author | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2011-02-11 08:20:35 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2011-02-11 08:20:35 +0100 |
commit | 84d920432c3397aab86414892b4766506236bc4c (patch) | |
tree | 66b45bf6560c18d848a205cc33d1b54d24662c50 /src/Hakyll/Core | |
parent | 38290835769494b555edd092d79e9523ea854531 (diff) | |
download | hakyll-84d920432c3397aab86414892b4766506236bc4c.tar.gz |
Add customRoute
Diffstat (limited to 'src/Hakyll/Core')
-rw-r--r-- | src/Hakyll/Core/Routes.hs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/Hakyll/Core/Routes.hs b/src/Hakyll/Core/Routes.hs index c1a034f..b6e1c12 100644 --- a/src/Hakyll/Core/Routes.hs +++ b/src/Hakyll/Core/Routes.hs @@ -12,6 +12,7 @@ module Hakyll.Core.Routes , idRoute , setExtension , ifMatch + , customRoute ) where import Data.Monoid (Monoid, mempty, mappend) @@ -69,3 +70,8 @@ ifMatch :: Pattern -> Routes -> Routes ifMatch pattern (Routes route) = Routes $ \id' -> if doesMatch pattern id' then route id' else Nothing + +-- | Create a custom route. This should almost always be used with 'ifMatch'. +-- +customRoute :: (Identifier -> FilePath) -> Routes +customRoute f = Routes $ Just . f |