add metadata to hide tags from menu
This commit is contained in:
parent
ce37f7c14b
commit
430a4c78d1
11
src/Main.hs
11
src/Main.hs
@ -45,6 +45,7 @@ config :: Configuration
|
|||||||
config =
|
config =
|
||||||
defaultConfiguration
|
defaultConfiguration
|
||||||
{ destinationDirectory = "public"
|
{ destinationDirectory = "public"
|
||||||
|
, previewPort = 8008
|
||||||
}
|
}
|
||||||
|
|
||||||
routeAsFilePath :: (FilePath -> FilePath) -> Routes
|
routeAsFilePath :: (FilePath -> FilePath) -> Routes
|
||||||
@ -63,6 +64,12 @@ metadataSort = sortOnM $ \Item{itemIdentifier} -> maybe (0 :: Integer) read <$>
|
|||||||
sortOnM :: forall m a b. (Monad m, Ord b) => (a -> m b) -> [a] -> m [a]
|
sortOnM :: forall m a b. (Monad m, Ord b) => (a -> m b) -> [a] -> m [a]
|
||||||
sortOnM f = fmap (map snd . List.sortOn fst) . mapM (\x -> (,x) <$> f x)
|
sortOnM f = fmap (map snd . List.sortOn fst) . mapM (\x -> (,x) <$> f x)
|
||||||
|
|
||||||
|
metadataShow :: [Item w] -> Compiler [Item w]
|
||||||
|
metadataShow = filterM $ \Item{itemIdentifier} -> maybe (True :: Bool) read <$> getMetadataField itemIdentifier "show"
|
||||||
|
|
||||||
|
metadata :: [Item w] -> Compiler [Item w]
|
||||||
|
metadata = metadataSort <=< metadataShow
|
||||||
|
|
||||||
unwrapped :: Snapshot
|
unwrapped :: Snapshot
|
||||||
unwrapped = "unwrapped"
|
unwrapped = "unwrapped"
|
||||||
|
|
||||||
@ -171,8 +178,8 @@ main =
|
|||||||
where
|
where
|
||||||
ctx' =
|
ctx' =
|
||||||
mconcat
|
mconcat
|
||||||
[ listField "tags-nav" defaultContext (metadataSort <=< mapM (uncurry renderTagNav) $ tagsMap tags)
|
[ listField "tags-nav" defaultContext (metadata <=< mapM (uncurry renderTagNav) $ tagsMap tags)
|
||||||
, listField "special-nav" defaultContext $ metadataSort =<< mapM (flip loadSnapshot unwrapped) =<< getMatches (fromGlob "special/**")
|
, listField "special-nav" defaultContext $ metadata =<< mapM (flip loadSnapshot unwrapped) =<< getMatches (fromGlob "special/**")
|
||||||
, frontendContext
|
, frontendContext
|
||||||
, defaultContext
|
, defaultContext
|
||||||
]
|
]
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: Index
|
title: Index
|
||||||
sort: -9999
|
sort: -9999
|
||||||
|
show: "False"
|
||||||
---
|
---
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user