Closed osteffich closed 9 years ago
Example of how you would use this in your mock_data.yml
:
page:
id: 1
name: "Home"
slug: "home"
url: "#home"
meta_description: "<%= Faker::Lorem.paragraph(5) %>"
title: "Home"
alternate_name: "Index"
depth: 1
pages:
- id: 2
name: "Study of Birds"
slug: "study-of-birds"
url: "#study-of-birds"
meta_description: "<%= Faker::Lorem.paragraph(5) %>"
title: "Study of Birds"
alternate_name: "Ornithology"
depth: 1
- id: 3
name: "Study of Fish"
slug: "study-of-fish"
url: "#study-of-fish"
meta_description: "<%= Faker::Lorem.paragraph(5) %>"
title: "Study of Fish"
alternate_name: "Ichthyology"
depth: 1
Note the new syntax for the pages:
, there is a YAML array being used:
Example:
Key:
- id: 1
- id: 2
- id: 3
This allow Hammer to get objects with multiple keys and values and is the first implementation of this structure in Hammer mock_data.yml
.
Now if you have the following radius tags:
<ul>
<r:children:each labels="name-of-your-label">
<li>
<a href="<r:page:url />"><r:page:name /></a>
</li>
</r:children:each>
</ul>
Hammer should generate the following HTML:
<ul>
<li><a href="#home">Home</a></li>
<li><a href="#study-of-birds">Study of Birds</a></li>
<li><a href="#study-of-fish">Study of Fish</a></li>
</ul>
This will not do any "finding" based on labels or any of that, it is a fairly dumb loop. And will reproduce the same loop if you were to use :descendants
, :ancestors
, :children
, or :siblings
tags.
I'm trying to do a labeled menu, and in hammer I get the error:
Hammer: children tag is not yet implemented
More about labeled menus here: http://cleanslatecms.wvu.edu/how-to/theme-development/page-label-menu