Skip to content
Snippets Groups Projects
Commit dd110e00 authored by Nicolas Lenz's avatar Nicolas Lenz :snowflake:
Browse files

don't set isActive for a category on indices

parent b4c5bdb0
No related branches found
No related tags found
No related merge requests found
Pipeline #2533 passed
......@@ -153,18 +153,13 @@ putIsActive page@Page{..} = page { pageDoc = addMeta "isActive" isActiveMeta pag
Nothing -> MetaMap Map.empty
Just category -> MetaMap $ Map.singleton category $ MetaBool True
-- isActive.category.foo is true for pages that have the category foo, and for pages that are an index for foo
-- isActive.category.foo is true for pages that have the category foo
isActiveMetaCategory :: MetaValue
isActiveMetaCategory = MetaMap $ insertIndex $ fromList $ map helper pageCategories where
isActiveMetaCategory = MetaMap $ fromList $ map helper pageCategories where
helper :: Text -> (Text, MetaValue)
helper category = (category, MetaMap $ Map.singleton category $ MetaBool True)
insertIndex :: Map Text MetaValue -> Map Text MetaValue
insertIndex meta = case indexFor page of
Nothing -> meta
Just category -> Map.insert category (MetaBool True) meta
-- isActive.page.foo is true if the current page has the slug foo
isActiveMetaPage :: MetaValue
isActiveMetaPage = let Pandoc meta _ = pageDoc in case lookupMetaPlain "slug" meta of
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment