hakyll-3.0.2.2: A simple static site generator library.

Hakyll.Web.Tags

Description

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).

Synopsis

Documentation

data Tags a Source

Data about tags

Constructors

Tags 

Fields

tagsMap :: Map String [Page a]
 

Instances

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

readTagsWithSource

Arguments

:: (Page a -> [String])

Function extracting tags from a page

-> [Page a]

Pages

-> 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

renderTagCloudSource

Arguments

:: (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

renderTagsFieldSource

Arguments

:: String

Destination key

-> (String -> Identifier)

Create a link for a tag

-> Compiler (Page a) (Page a)

Resulting compiler

Render tags with links

renderCategoryFieldSource

Arguments

:: String

Destination key

-> (String -> Identifier)

Create a category link

-> Compiler (Page a) (Page a)

Resulting compiler

Render the category in a link