Skip to content

Latest commit

 

History

History
63 lines (46 loc) · 1.75 KB

data-and-collections.md

File metadata and controls

63 lines (46 loc) · 1.75 KB

Data and collections

Jekyll provides two main ways to create and maintain large lists/sets of items: data and collections.

The template comes with a few placeholder data lists for common needs, but if you need to create more/different ones, here's how.

{% hint style="info" %} This page just explains how to make these lists. To actually display them on your site, use the list component. {% endhint %}

Data

If you want to have a large set of structured or nested items in a single file, use a data file.

Put a .yaml file in the /_data folder with any name, and fill it with data. The structure of the data can be arbitrary.

Example:

{% code title="/_data/some-list.yaml" %}

# some item
- title: Some name
  tags:
    - tag A
    - tag B
  description: Some description

# another item
...

{% endcode %}

Collections

If you want to have a large set of items in separate files that can also generate their own separate pages on your site, use collections.

Put .md files in a folder prefixed with a _, and fill their front matters with data. To generate a separate page for each item in the collection, set output: true in your config file as described here.

Example:

{% code title="/_some-list/some-file.md" %}

---
title: Some name
tags:
  - tag A
  - tag B
description: Some description
---

Some Markdown content

{% endcode %}

{% code title="/_some-list/another-file.md" %}

---
title: Another name
---

Some Markdown content

{% endcode %}