Collection

Collection

Collection class

Constructor

new Collection(options)

Create a Collection object

Source:
Parameters:
Name Type Description
options Object

Options for collection

Name Type Description
jekyll Object

The Jekyll instance for this collection

name String

The name of this collection

path String

The path to this collection

Methods

body(paramsopt) → {Promise.<String>}

Get body for this collection (using defaultsKey method)

Source:
Parameters:
Name Type Attributes Description
params Object <optional>

Additional params (sent to github)

Returns:
Type:
Promise.<String>
  • Returns promise with parsed body

createItem(data, paramsopt)

Create a new item in this collection

Source:
Parameters:
Name Type Attributes Description
data Object

Data for new collection item

Name Type Attributes Description
name String

Name for new collection item

fields Object <optional>

Fields for new collection item

body String <optional>

Content for new collection item

params Object <optional>

Additional params (sent to github)

defaults(paramsopt) → {Promise.<Object>}

Get defaults for a collection (from "_fields.md" file in collection dir)

Source:
Parameters:
Name Type Attributes Description
params Object <optional>

Additional params (sent to github)

Returns:
Type:
Promise.<Object>
  • Returns promise with parsed data

defaultsKey(key, paramsopt) → {Promise.<Object>}

Load a single key from resolved defaults (fields or body)

Source:
Parameters:
Name Type Attributes Description
key String

Key to be loaded from defaults

params Object <optional>

Additional params (sent to github)

Returns:
Type:
Promise.<Object>
  • Returns promise with parsed data for specified key

fields(paramsopt) → {Promise.<Object>}

Get fields for this collection (using defaultsKey method)

Source:
Parameters:
Name Type Attributes Description
params Object <optional>

Additional params (sent to github)

Returns:
Type:
Promise.<Object>
  • Returns promise with parsed fields

items(paramsopt) → {Promise.<Array>}

Load items for this collection

Source:
Parameters:
Name Type Attributes Description
params Object <optional>

Additional params (sent to github)

Returns:
Type:
Promise.<Array>
  • Returns promise with array of CollectionItem objects

parsePath(path, paramsopt) → {Promise.<Object>}

Parse Jekyll file path

Source:
Parameters:
Name Type Attributes Description
path String

Path to be parsed (for Jekyll front matter + body content)

params Object <optional>

Additional params (sent to github)

Returns:
Type:
Promise.<Object>
  • Returns promise with parsed data