diff options
| author | Eugen Wissner <belka@caraus.de> | 2026-04-08 18:09:22 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2026-04-08 18:09:22 +0200 |
| commit | 6d7472bc69a166f28fa884a07605b6f3c3878917 (patch) | |
| tree | 56892d06fd5d98282f703d151bb6c9932fe3e287 | |
| parent | e0dddfbb8c2b304b82ceaa4f04360e8a6f4589ff (diff) | |
| download | flevum-6d7472bc69a166f28fa884a07605b6f3c3878917.tar.gz | |
Link tags directly to a directory with a trailing slash
| -rw-r--r-- | src/Main.hs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/Main.hs b/src/Main.hs index 65e29aa..2fcfbcc 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -177,18 +177,18 @@ tagsCloud tags $ forM (tagsMap tags) . go where categoryContextF "title" _ = pure . StringField . categoryTitle - categoryContextF "url" _ = pure . StringField . ("/" ++) . categoryTitle + categoryContextF "url" _ = pure . StringField + . ('/' :) . (++ "/") . categoryTitle categoryContextF "body" _ = pure . StringField . itemBody categoryContextF key _ = const $ noResult $ "Tried field " ++ key categoryTitle = last . directoryNames . itemIdentifier - directoryNames = init . splitDirectories .toFilePath + directoryNames = init . splitDirectories . toFilePath go :: Item String -> (String, [Identifier]) -> Compiler (Item FilePath) - go Item{ itemIdentifier = currentPage } tag = do - let tagId = tagsMakeId tags $ fst tag + go Item{ itemIdentifier = currentPage } (tag, _) = do + let tagId = tagsMakeId tags tag tagsMetadata <- getMetadataField currentPage "tags" - let isActiveClass - = directoryNames currentPage == directoryNames tagId - || Just (fst tag) == tagsMetadata + let isActiveClass = directoryNames currentPage == directoryNames tagId + || Just tag == tagsMetadata pure $ Item tagId $ if isActiveClass then "active" else "" withoutRootRoute :: Routes |
