on master help sign in
Add customRoute
commit84d920432c3397aab86414892b4766506236bc4c authorJasper Van der Jeugt <jaspervdj@gmail.com> dateFri 11 Feb 2011, 08:20 (16 years ago) parent3829083
1 file changed+6
src/Hakyll/Core/Routes.hs+6
src/Hakyll/Core/Routes.hs+6
@@ -12,6 +12,7 @@ module Hakyll.Core.Routes
1212 , idRoute
1313 , setExtension
1414 , ifMatch
15+ , customRoute
1516 ) where
1617
1718import Data.Monoid (Monoid, mempty, mappend)
@@ -69,3 +70,8 @@ ifMatch :: Pattern -> Routes -> Routes
6970ifMatch pattern (Routes route) = Routes $ \id' ->
7071 if doesMatch pattern id' then route id'
7172 else Nothing
73+
74+-- | Create a custom route. This should almost always be used with 'ifMatch'.
75+--
76+customRoute :: (Identifier -> FilePath) -> Routes
77+customRoute f = Routes $ Just . f