nani.wtf/static-site-generator/Formats/Posts.hs
h7x4 dcdf36f4dd
Revamp:
- Switch from `cabal2nix` and haskell overlay to `developPackage`
- Restructure directories to have more descriptive names
- Fix `nix run`
2023-03-11 16:56:32 +01:00

14 lines
403 B
Haskell

module Formats.Posts where
import Hakyll
import Util.Hakyll.Routes
import Data.Maybe (fromMaybe)
import Util.Hash (FileHashes)
import Debug.Trace
postRoute :: FileHashes -> Routes
postRoute hashes = titleRouteElseHash `composeRoutes` prefixRoute "posts/"
where
titleRouteElseHash :: Routes
titleRouteElseHash = metadataRoute $ \metadata -> fromMaybe (hashRoute hashes) $ titleRoute metadata