From ca1d4d3d4371c8175ea6addb1ca1b09c3b56a7bb Mon Sep 17 00:00:00 2001 From: Chris Wells Date: Sat, 25 Jan 2025 14:33:21 -0600 Subject: Adding templates and cleaning up --- src/Hakyll/Util.hs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/Hakyll/Util.hs (limited to 'src/Hakyll/Util.hs') diff --git a/src/Hakyll/Util.hs b/src/Hakyll/Util.hs new file mode 100644 index 0000000..edbdb16 --- /dev/null +++ b/src/Hakyll/Util.hs @@ -0,0 +1,19 @@ +module Hakyll.Util + ( dropParentRoute + , modifyDirRoute + , modifyDirRoute_ + ) where + +import Prolog +import Hakyll +import System.FilePath + +-- | Drop some number of parent directories +dropParentRoute :: Int -> Routes +dropParentRoute n = modifyDirRoute_ $ drop n + +modifyDirRoute :: ([FilePath] -> FilePath) -> Routes +modifyDirRoute f = customRoute $ f . splitDirectories . toFilePath + +modifyDirRoute_ :: ([FilePath] -> [FilePath]) -> Routes +modifyDirRoute_ f = modifyDirRoute $ joinPath . f -- cgit v1.2.3