This week I’ve published a Liquid layout for building JSON feeds from Jekyll collections and FrontMatter data. Check the documentation for detailed getting started and usage instructions, the source code is available on GitHub. What follows is the TLDR for installation and usage…

Clone/Install

cd "<your-git-project-path>"


git checkout gh-pages

mkdir -vp "_layouts/modules"


git submodule add -b main\
                  --name "feed-json"\
                  "https://github.com/liquid-utilities/feed-json.git"\
                  "_layouts/modules/feed-json"

Usage

_config.yml (snip)

collections_dir: documentation
collections:
  example-collection:
    output: true
    permalink: /:collection/:name/

documentation/_example-collection/feed.json

layout: modules/feed-json/feed-json
title: Example Collection
collection_name: example-collection
collection_home: /example-collection/
date: 2021-01-01 11:12:13 -0700
content_type: xhtml
permalink: /:collection/:name:output_ext

documentation/_example-collection/something-about-something.md

---
## Layout may be `default`, `post`, or `page` depending upon theme
layout: post

title: Title of Page
date: 2021-01-01 13:42:11 -0300
#date_updated:  ## Optional and formatted like `date` above

description: A description of page content
tags:
  - spam
  - flavored
  - ham
---


Content that expands on the topic of something about some thing

Expect JSON output similar to…

https://<account>.github.io/<project>/example-collection/feed.json

{
  "version": "https://jsonfeed.org/version/1",
  "title": "Example Collection",
  "home_page_url": "https://<account>.github.io/<project>/",
  "feed_url": "https://<account>.github.io/<project>/example-collection/feed.json",
  "description": "A description of page content",
  "favicon": "https://<account>.github.io/favicon.ico",
  "author": {
    "name": "S0AndS0"
  },
  "expired": false
  ],
  "items": [
    {
      "id": "https://<account>.github.io/<project>/posts/<name>.<ext>",
      "url": "https://<account>.github.io/<project>/posts/<name>.<ext>",
      "title": "Title of Page",
      "content_html": "",
      "summary": "A description of page content",
      "date_published": "2021-01-01T14:13:41-14:00",
      "date_modified": "2021-01-02T14:15:00-14:00",
      "author": {
        "name": "S0AndS0"
      },
      "tags": [
        "spam",
        "flavored",
        "ham"
      ],
      "attachments": [
        {
          "url": "",
          "mime_type": "",
          "title": "",
          "size_in_bytes": 99,
          "duration_in_seconds": 42
        }
      ],
      "_custom_entry": {
        "about": "",
        "explicit": false,
        "copywrite": "AGPL-3.0",
        "owner": "",
        "subtitle": ""
      },
      "content_text": "Content that expands on the topic of something about some thing"
    }
  ]
}