/jekyll-feed-json

:memo: A Jekyll plugin to generate a JSON feed of your Jekyll posts

Primary LanguageRubyMIT LicenseMIT

Jekyll JSON Feed plugin

A Jekyll plugin to generate an JSON feed of your Jekyll posts

Not intending to register this with rubygems. Simply to meet requirements for another project.

Feel free to fork, improve and distribute.

Installation

Add this line to your site's Gemfile:

group :jekyll_plugins do
   gem "jekyll-feed-json", "~> 0.0.1", :git => "git@github.com:mryellow/jekyll-feed-json.git"
end

And then add this line to your site's _config.yml:

gems:
  - jekyll-feed-json

Usage

The plugin will automatically generate a JSON feed at /feed.json.

Optional configuration options

The plugin will automatically use any of the following configuration variables, if they are present in your site's _config.yml file.

  • title or name - The title of the site, e.g., "My awesome site"
  • description - A longer description of what your site is about, e.g., "Where I blog about Jekyll and other awesome things"
  • url - The URL to your site, e.g., http://example.com. If none is provided, the plugin will try to use site.github.url.
  • author - Global author information (see below)

Already have a feed path?

Do you already have an existing feed someplace other than /feed.json, but are on a host like GitHub Pages that doesn't support machine-friendly redirects? If you simply swap out jekyll-feed-json for your existing template, your existing subscribers won't continue to get updates. Instead, you can specify a non-default path via your site's config.

feed:
  path: atom.json

To note, you shouldn't have to do this unless you already have a feed you're using, and you can't or wish not to redirect existing subscribers.

Optional front matter

The plugin will use the following post metadata, automatically generated by Jekyll, which you can override via a post's YAML front matter:

  • date
  • title
  • excerpt
  • id
  • category
  • tags

Additionally, the plugin will use the following values, if present in a post's YAML front matter:

  • image - URL of an image that is representative of the post (can also be passed as image.path)

  • author - The author of the post, e.g., "Dr. Jekyll". If none is given, feed readers will look to the feed author as defined in _config.yml. Like the feed author, this can also be an object or a reference to an author in _data/authors.yml (see below).

Why JSON, and not RSS?

Great question. In short, JSON is used by Javascript and we're all busy writing Javascript apps. XML means additional metadata overhead and increased parsing requirements.