Filter blog posts by YAML data

I have a blog that has 3 kinds of posts:

  • Post Type One
  • Post Type Two
  • Post Type Three

In the blog archive I have my posts sorted by date.

-page_articles.sort_by{|a| a.date }.reverse.each_with_index do |article, i|
    %article{class: article.data.link ? "blog link" : "blog"}
        =dt article.date
        =tag_list article.tags
        =blog_link article
        =article.data.summary
        =link_to 'Read me', article

What I want is to sort by data AND sort by a YAML data attribute for the post type. I tried this:

-page_articles.sort_by{|a| a.date, |b| b.data.kind.post-type-one}.reverse.each_with_index do |article, i|
    %article{class: article.data.link ? "blog link" : "blog"}
        =dt article.date
        =tag_list article.tags
        =blog_link article
        =article.data.summary
        =link_to 'Read me', article

But that didn’t work. I was wondering what the correct syntax would be to get something like this working.

For reference the post YAMl would look like this:

---
kind: post-type-one
---

Hi! Have you did some movements in regard? I would like to do the same, can’t figure why your solution do not work…