From e82648073a19f96d8344d0120a03184ae510e1f4 Mon Sep 17 00:00:00 2001 From: Paul Oliver Date: Mon, 7 Apr 2025 10:47:51 -0700 Subject: Improves haskell --- site.hs | 49 ++++++++++++++++++++++--------------------------- 1 file changed, 22 insertions(+), 27 deletions(-) (limited to 'site.hs') diff --git a/site.hs b/site.hs index a02e75d..76e6f50 100644 --- a/site.hs +++ b/site.hs @@ -1,32 +1,27 @@ {-# LANGUAGE OverloadedStrings #-} -import Hakyll - ( Configuration(..) - , compile - , compressCssCompiler - , defaultConfiguration - , defaultContext - , hakyllWith - , idRoute - , loadAndApplyTemplate - , match - , pandocCompiler - , relativizeUrls - , route - , setExtension - , templateBodyCompiler - ) +import Hakyll qualified as H -config :: Configuration -config = defaultConfiguration {deployCommand = "rsync -rv _site/ debnode:portfolio"} +pandoc :: H.Compiler (H.Item String) +pandoc = + H.pandocCompiler + >>= H.loadAndApplyTemplate "templates/default.html" H.defaultContext + >>= H.relativizeUrls + +index :: H.Rules () +index = + H.match "index.md" $ do + H.route $ H.setExtension "html" + H.compile pandoc + +css :: H.Rules () +css = + H.match "css/*" $ do + H.route H.idRoute + H.compile H.compressCssCompiler + +template :: H.Rules () +template = H.match "templates/*" $ H.compile H.templateBodyCompiler main :: IO () -main = - hakyllWith config $ do - match "index.md" $ do - route $ setExtension "html" - compile $ pandocCompiler >>= loadAndApplyTemplate "templates/default.html" defaultContext >>= relativizeUrls - match "css/*" $ do - route idRoute - compile compressCssCompiler - match "templates/*" $ compile templateBodyCompiler +main = H.hakyllWith H.defaultConfiguration $ index >> css >> template -- cgit v1.2.1