2

I've got a recipe site I'm powering with Jekyll, and now I want to add Microdata (itemscope, itemprop, etc.) into the output static page. I've got a couple lists (ingredients, directions, etc.) and I'm not sure how to have Jekyll render these with the added Microdata tacked on.

I assume I need a Convertor or Filter or some other thing, but I've got next to no experience with Jekyll. Anyone done something similar before?

unor
  • 92,415
  • 26
  • 211
  • 360
clark
  • 195
  • 1
  • 8
  • Here's the markdown I've written, the current output, and the desired output: http://pastebin.com/YQ77C970 – clark Jan 21 '15 at 19:00

1 Answers1

1

Found a way in kramdown documentation

  • {: itemprop="ingredient"} 2 tablespoons butter
  • {: itemprop="ingredient"} 1 cup diced onion
  • {: itemprop="ingredient"} 1 cup shredded carrot

But what if :

  • you put your ingredients in the front matter

my_recipe.md

---
layout: page
title: My nice recipe
ingredients:
    - 2 tablespoons butter
    - 1 cup diced onion
    - 1 cup shredded carrot
---

{% include recipe_head.html %}

###How to do it

...
  • make a template

**_includes/recipe_head.html

<h3>{{ page.title }}</h3>
<h4>Ingredients</h4>
<ul>
    {% for ingredient in page.ingredients %}
    <li itemprop="ingredient">{{ ingredient }}</li>
    {% endfor %}
</ul>

This will be far more maintainable.

David Jacquel
  • 51,670
  • 6
  • 121
  • 147