Using data from frontmatter
This is a test of frontmatter data access in pages.
The frontmatter for this page looks like this:
title: Using data from frontmatter
label: Frontmatter data
data:
pets:
- type: cat
sound: meow
- type: dog
sound: woof
Page templates have access to the data set in frontmatter:
<% page.data.pets.each do |pet| %>
* A <%= pet.type %> makes a '<%= pet.sound %>' noise.
<% end %>
This is the output:
- A cat makes a 'meow' noise.
- A dog makes a 'woof' noise.