liquid - Jekyll - Can't reverse sort by date -
i'm trying sort 3 recent, 'featured' posts on blog, loop have won't let me sort collection show recent posts first.
what have below outputs 3 recent posts on blog, ignores where_exp , displays both featured , non-featured posts. if remove 'reverse' filter after sort date sort featured posts, sorts them oldest newest. i've tried reassigning featured-posts variable sort reverse-date again before loop doesn't work.
everything i've tried far won't let me display 3 recent, featured posts in site, i'm hoping can tell me i'm going wrong..
post front matter:
--- post_date: 2017-08-14 00:00:00 featured: true ---
page for-loop:
{% assign sorted-posts = site.posts | sort: 'post_date' | reverse %} {% assign featured-posts = sorted-posts | where_exp:"post","post.featured" %} {% post in featured-posts limit:3 %} <h2><a href="{{ post.url }}">{{ post.title | truncate: 58 }}</a></h2> {% endfor %}
output:
three recent posts on website regardless of whether they're 'featured' or not.
thanks in advance
solved upgrading jekyll. running version 3.0.0, upgraded 3.5.2 , issue has been resolved.
Comments
Post a Comment