diff --git a/ssg/src/Main.hs b/ssg/src/Main.hs index 95a1f8d..c0d00b2 100644 --- a/ssg/src/Main.hs +++ b/ssg/src/Main.hs @@ -69,7 +69,7 @@ main = hakyllWith config $ do match "posts/*" $ do let ctx = constField "type" "article" <> postCtx - route $ constRoute "posts/" <> metadataRoute titleRoute + route $ metadataRoute titleRoute `composeRoutes` (prefixRoute "posts/") compile $ pandocCompilerCustom >>= loadAndApplyTemplate "templates/post.html" ctx @@ -240,3 +240,6 @@ fileNameFromTitle = titleRoute :: Metadata -> Routes titleRoute = constRoute . fileNameFromTitle + +prefixRoute :: FilePath -> Routes +prefixRoute p = customRoute $ \id -> p ++ (toFilePath id)