Jekyll-json-ld: liquid tags in jekyll

An as-of-now very simple liquid filter that allows you to specify an object in the Front Matter YAML and render it into JSON-LD within your output.

Github

For issue tracking and more see the github repository.

WARNING

This is currently an extremely limited implementation that does little more than convert a YAML object to JSON. Validation, normalization etc. are yet to come.

Installation

Require the jekyll-json-ld gem using your favorite method, possibly:

group :jekyll_plugins do
  gem "some-other-gem"
  gem "jekyll-json-ld"
end

Example

The object(s) can, for example, be specified in the Front Matter of a template, page or post:

---
layout: default
recipe:
  "@context": http://schema.org/
  "@type": Recipe
  name: "Grandma's Holiday Apple Pie"
  datePublished: 2015-12-24
  description: Is this a really tasty apple pie or have I fallen victim to some sort of culinary Stockholm Syndrom?
  recipeIngredient:
    - 500g brown sugar
    - 200ml Whiskey
---

…and so on. For references regarding defined schemes see https://developers.google.com/structured-data/ or Schema.org-

To run the YAML through the filter place (for this example) ` ` within the body of your document. This renders the following JSON-LD markup:

<script type="application/ld+json">
{
  "@context":"http://schema.org/",
  "@type":"Recipe",
  "name":"Grandma's Holiday Apple Pie",
  "datePublished":"2015-12-24",
  "description":"Is this a really tasty apple pie or
    have I fallen victim to some sort of culinary
    Stockholm Syndrom?",
  "recipeIngredient":
    ["500g brown sugar","200ml Whiskey"]
}
</script>
Jekyll-JSON-LD: Liquid Tags in Jekyll - mw