hakyll- A static website compiler library

Safe HaskellSafe-Infered



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 Source

Data about tags




tagsMap :: [(String, [Page a])]


Typeable1 Tags 
Show a => Show (Tags a) 
Binary a => Binary (Tags a) 
Writable (Tags a) 



:: (Page a -> [String])

Function extracting tags from a page

-> [Page a]


-> Tags a

Resulting tags

Higher-level function to read tags

readTags :: [Page a] -> Tags aSource

Read a tagmap using the tags metadata field

readCategory :: [Page a] -> Tags aSource

Read a tagmap using the category metadata field



:: (String -> Identifier (Page a))

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 (Page a)) -> Compiler (Tags a) StringSource

Render a simple tag list in HTML, with the tag count next to the item



:: String

Destination key

-> (String -> Identifier a)

Create a link for a tag

-> Compiler (Page a) (Page a)

Resulting compiler

Render tags with links



:: String

Destination key

-> (String -> Identifier a)

Create a category link

-> Compiler (Page a) (Page a)

Resulting compiler

Render the category in a link

sortTagsBy :: ((String, [Page a]) -> (String, [Page a]) -> Ordering) -> Compiler (Tags a) (Tags a)Source

Sort tags using supplied function. First element of the tuple passed to the comparing function is the actual tag name.

caseInsensitiveTags :: (String, [Page a]) -> (String, [Page a]) -> OrderingSource

Sample sorting function that compares tags case insensitively.