I’m so used to load .yml file to hash that I’ve forgotten .yml can just load directly to array. In fact, that’s like the most basic way of doing this.
This is how I normally create my .yml.
That will give me a hash.
In my mind, that’s the default way of doing things. Few days back I decided to include all my previous talks and interviews in my site. You can see how I started in this commit. Take a close look at my index.html file.
While this worked, I started to see pattern emerged. I have the same list for talks as well. I’ll have to repeat the same li over and over again. Maybe it would be better if I could store my interviews and talks in a collection and just loop it here instead. Configuration for this site stored in _config.yml, so seems like it would make sense if I store my interviews and talks there too.
My problem was, how do I store them in an array? I checkout yaml.org and the first example for ruby is simple sequence list. List without key. That works really well. Example:
That will give me hash with sample as the key, and an array of one, two.
With that knowledge, I made this commit and now I can use for loop in my index.html for talks and interviews.