well stuff

This commit is contained in:
Mirek Kratochvil 2023-05-22 23:23:16 +02:00
parent 693f1944c5
commit 903a308167
3 changed files with 25 additions and 4 deletions

View file

@ -19,5 +19,7 @@ this that
## Something else
![awesome](img/awesome.png)
more nonsense
haha
haha [linek](/tags/)

View file

@ -62,7 +62,9 @@ extractHTagLinks ident = do
pure (to, htags)
invTags :: [(Identifier, [[String]])] -> [([String], [String])]
invTags x = map (fmap (map ('/':) . nub . map toFilePath)) $ groupSort [(t, p) | (p, htl) <- x, ht <- htl, t <- inits ht]
invTags x =
map (fmap (map ('/' :) . nub . map toFilePath)) $
groupSort [(t, p) | (p, htl) <- x, ht <- htl, t <- inits ht]
makeTag :: [FilePath] -> [String] -> Rules ()
makeTag htag pages =
@ -72,8 +74,14 @@ makeTag htag pages =
let ctx =
mconcat
[ constField "title" ("Pages tagged " ++ joinPath htag)
, listField "htags" (field "htag" (return . itemBody)) (traverse makeItem htag)
, listField "pages" (field "page" (return . itemBody)) (traverse makeItem pages)
, listField
"htags"
(field "htag" (return . itemBody))
(traverse makeItem htag)
, listField
"pages"
(field "page" (return . itemBody))
(traverse makeItem pages)
, defaultContext
]
makeItem "" >>= loadAndApplyTemplate "templates/tag.html" ctx >>=

View file

@ -9,5 +9,16 @@ executable site
, hakyll == 4.16.*
, filepath
, extra
, transformers
, containers
, pandoc
, pandoc-types
, microlens
, microlens-th
, microlens-mtl
, microlens-aeson
, data-default
, text
, yaml
ghc-options: -threaded -rtsopts -with-rtsopts=-N
default-language: Haskell2010