Module containing some specialized functions to deal with tags. This Module follows certain conventions. My advice is to stick with them if possible.
More concrete: all functions in this module assume that the tags are
located in the tags
field, and separated by commas. An example file
foo.markdown
could look like:
--- author: Philip K. Dick title: Do androids dream of electric sheep? tags: future, science fiction, humanoid --- The novel is set in a post-apocalyptic near future, where the Earth and its populations have been damaged greatly by Nuclear...
All the following functions would work with such a format. In addition to tags, Hakyll also supports categories. The convention when using categories is to place pages in subdirectories.
An example, the page posts/coding/2010-01-28-hakyll-categories.markdown
Tags or categories are read using the readTags
and readCategory
functions. This module only provides functions to work with tags:
categories are represented as tags. This is perfectly possible: categories
only have an additional restriction that a page can only have one category
(instead of multiple tags).
- data Tags a = Tags {}
- readTagsWith :: (Page a -> [String]) -> [Page a] -> Tags a
- readTags :: [Page a] -> Tags a
- readCategory :: [Page a] -> Tags a
- renderTagCloud :: (String -> Identifier) -> Double -> Double -> Compiler (Tags a) String
- renderTagList :: (String -> Identifier) -> Compiler (Tags a) String
- renderTagsField :: String -> (String -> Identifier) -> Compiler (Page a) (Page a)
- renderCategoryField :: String -> (String -> Identifier) -> Compiler (Page a) (Page a)
Documentation
Data about tags
:: (Page a -> [String]) | Function extracting tags from a page |
-> [Page a] | Pages |
-> Tags a | Resulting tags |
Higher-level function to read tags
readCategory :: [Page a] -> Tags aSource
Read a tagmap using the category
metadata field
:: (String -> Identifier) | Produce a link for a tag |
-> Double | Smallest font size, in percent |
-> Double | Biggest font size, in percent |
-> Compiler (Tags a) String | Tag cloud renderer |
Render a tag cloud in HTML
renderTagList :: (String -> Identifier) -> Compiler (Tags a) StringSource
Render a simple tag list in HTML, with the tag count next to the item
:: String | Destination key |
-> (String -> Identifier) | Create a link for a tag |
-> Compiler (Page a) (Page a) | Resulting compiler |
Render tags with links