use human tag names for search indexes
This commit is contained in:
parent
4a32e69bff
commit
0e717b5dda
6
site.hs
6
site.hs
|
@ -507,15 +507,15 @@ mkSearchData mount pi = do
|
||||||
-- TODO: unify retrieval of tags
|
-- TODO: unify retrieval of tags
|
||||||
let tags =
|
let tags =
|
||||||
sort $ pi ^.. pageMeta . key "tags" . values . _String . to T.unpack
|
sort $ pi ^.. pageMeta . key "tags" . values . _String . to T.unpack
|
||||||
|
tagnames <- traverse (traverse getTagName . splitDirectories) tags
|
||||||
|
let tagarray = Y.array . map (Y.array . map fromString) $ tagnames
|
||||||
if pi ^? pageMeta . key "search" . _Bool == Just False -- `off` gets parsed as bool
|
if pi ^? pageMeta . key "search" . _Bool == Just False -- `off` gets parsed as bool
|
||||||
then pure []
|
then pure []
|
||||||
else pure $
|
else pure $
|
||||||
[ Y.object
|
[ Y.object
|
||||||
[ ("link", fromString link)
|
[ ("link", fromString link)
|
||||||
, ("title", maybe (fromString mount) Y.String title)
|
, ("title", maybe (fromString mount) Y.String title)
|
||||||
, ( "tags"
|
, ("tags", tagarray)
|
||||||
, Y.array $
|
|
||||||
map (Y.array . map fromString . splitDirectories) tags)
|
|
||||||
, ("text", Y.String text)
|
, ("text", Y.String text)
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in a new issue