Jekyll/Liquid, group by condition?

Viewed 6

I tried what I want with where and it's working

{%assign a=site.posts|group_by:"title"|sort:"size"|reverse%}
{%assign b=a|where_exp:"a","a.name.size <= 5 "%}
{%for g in b-%}
{{g.name}}({{g.size}})
{%-unless forloop.last%}、{%endunless%}
{%-endfor%}

{%assign b=a|where_exp:"a","a.name.size>5"%}
{%for g in b-%}
{{g.name}}({{g.size}})
{%-unless forloop.last%}、{%endunless%}
{%-endfor%}

but can't get it work with group by

{%assign a=a|group_by_exp:"a","a.name.size>5"%}
{%for b in a-%}
{%for g in b.items-%}
{{g.name}}({{g.size}})
{%-unless forloop.last%}、{%endunless%}
{%-endfor%}
{%endfor%}
0 Answers
Related