Iterating over lists in Bridgetown Frontmatter
While building this site using Bridgetown, I bumped into an issue.
I wanted to create lists in the frontmatter of each item in a collection. For my “projects” collection, I wanted a list of tags. And then in the HTML, I wanted to iterate over each tag and display it as a badge.
I tried a couple different ways to fix this but nothing was working, until I found a solution.
My frontmatter looks like this:
tags: - elixir - GIS - mapping
And in my view I have:
for tag in project.data.tags tag end
It seems simple but I couldn’t find this in the docs anywhere so I wanted to share. Hope it helps!