hakyll-4.4.1.1: A static website compiler library

Safe HaskellNone

Hakyll.Web.Template.Context

Synopsis

Documentation

data ContextField Source

Mostly for internal usage

Constructors

StringField String 
forall a . ListField (Context a) [Item a] 

newtype Context a Source

Constructors

Context 

Instances

metadataField :: Context aSource

Map any field to its metadata value, if present

urlField :: String -> Context aSource

Absolute url to the resulting item

pathField :: String -> Context aSource

Filepath of the underlying file of the item

titleField :: String -> Context aSource

This title field takes the basename of the underlying file by default

dateFieldSource

Arguments

:: String

Key in which the rendered date should be placed

-> String

Format to use on the date

-> Context a

Resulting context

When the metadata has a field called published in one of the following formats then this function can render the date.

  • Mon, 06 Sep 2010 00:01:00 +0000
  • Mon, 06 Sep 2010 00:01:00 UTC
  • Mon, 06 Sep 2010 00:01:00
  • 2010-09-06T00:01:00+0000
  • 2010-09-06T00:01:00Z
  • 2010-09-06T00:01:00
  • 2010-09-06 00:01:00+0000
  • 2010-09-06 00:01:00
  • September 06, 2010 00:01 AM

Following date-only formats are supported too (00:00:00 for time is assumed)

  • 2010-09-06
  • September 06, 2010

Alternatively, when the metadata has a field called path in a folder/yyyy-mm-dd-title.extension format (the convention for pages) and no published metadata field set, this function can render the date.

dateFieldWithSource

Arguments

:: TimeLocale

Output time locale

-> String

Destination key

-> String

Format to use on the date

-> Context a

Resulting context

This is an extended version of dateField that allows you to specify a time locale that is used for outputting the date. For more details, see dateField.

getItemUTCSource

Arguments

:: MonadMetadata m 
=> TimeLocale

Output time locale

-> Identifier

Input page

-> m UTCTime

Parsed UTCTime

Parser to try to extract and parse the time from the published field or from the filename. See dateField for more information. Exported for user convenience.

modificationTimeFieldSource

Arguments

:: String

Key

-> String

Format

-> Context a

Resuting context

modificationTimeFieldWithSource

Arguments

:: TimeLocale

Time output locale

-> String

Key

-> String

Format

-> Context a

Resulting context

teaserFieldSource

Arguments

:: String

Key to use

-> Snapshot

Snapshot to load

-> Context String

Resulting context

A context with teaser key which contain a teaser of the item. The item is loaded from the given snapshot (which should be saved in the user code before any templates are applied).