- Yes, you can do something similar:
---
title: Adventure Time
category: [tv shows, pendleton ward]
---
The frontmatter is any valid YAML. If you want to know what’s possible, you can read the YAML spec.
Alternatively, you could transform this at the Ruby level:
---
category: tv shows, pendleton ward
---
current_page.data.category # => "tv shows, pendleton ward"
current_page.data.category.split(/,\s*/) # => ["tv shows", "pendleton ward"]
I would recommend sticking with valid YAML for simplicity, though.
- Yes, although we don’t call them nested arrays, we call them Hashes, as that’s what they’re mapped to in Ruby.
You’d write it a little differently:
category:
tv shows:
- Grey's Anatomy
- Supernatural
books:
Dan Brown:
- Angels and Demons
- The Da Vinci Code
J.K. Rowling:
- Harry Potter and the Goblet of Fire
Dale Carnegie:
- How to Win Friends and Influence People
Here’s how this looks in Ruby:
current_page.data.category
# {
# "category" => {
# "tv shows" => ["Grey's Anatomy", "Supernatural"],
# "books" => {
# "Dan Brown" => ["Angels and Demons", "The Da Vinci Code"],
# "J.K. Rowling" => ["Harry Potter and the Goblet of Fire"],
# "Dale Carnegie" => ["How to Win Friends and Influence People"]
# }
# }
# }
You can access any key using this notation:
current_page.data.category.books
# {
# "Dan Brown" => ["Angels and Demons", "The Da Vinci Code"],
# "J.K. Rowling" => ["Harry Potter and the Goblet of Fire"],
# "Dale Carnegie" => ["How to Win Friends and Influence People"]
# }
- An external search engine would do the trick, yes. There are lots of solutions available. I’m no expert at this, but you might want to check out a service like Websolr or Searchify, or CloudSearch. The advantage is you can submit custom data (like authors or ratings), and customise the weighting that each of those fields has on the results for the user (e.g. a search match on an author is more important than a match on the body of the page).