Last active
August 29, 2015 13:57
-
-
Save jonathan-beebe/9916897 to your computer and use it in GitHub Desktop.
Looping through data using Assemble.io + Handlebars
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
headings: [1, 2, 3, 4, 5, 6] | |
--- | |
<div data-section="headings"> | |
{{#each headings}} | |
{{#withHash num=this text="Heading"}} | |
<h{{num}}>{{text}} {{num}}</h{{num}}> | |
{{/withHash}} | |
{{/each}} | |
</div> | |
<!-- or --> | |
<div data-section="headings"> | |
{{#withHash text="Heading" items="123456"}} | |
{{#forEach items}} | |
<h{{.}}>{{../text}} {{.}}</h{{.}}> | |
{{/forEach}} | |
{{/withHash}} | |
</div> | |
<!-- renders --> | |
<div data-section="headings"> | |
<h1>Heading 1</h1> | |
<h2>Heading 2</h2> | |
<h3>Heading 3</h3> | |
<h4>Heading 4</h4> | |
<h5>Heading 5</h5> | |
<h6>Heading 6</h6> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment