From 01ed1a3308c4f008337e34738eb8c9244414e06d Mon Sep 17 00:00:00 2001 From: h7x4 Date: Wed, 16 Mar 2022 10:56:16 +0100 Subject: [PATCH] fix path prefix --- ssg/src/Main.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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)