Skip to content

Sort by newest date? #1822

Discussion options

You must be logged in to vote

I managed to get it working with the following liquid code:

{% assign postCount = 4 %}
{% assign postList = collections.posts | reverse %}
{% for post in postList limit:postCount %}
  <a href="{{ post.url }}" class="flexContainer mb-05">
    <h3 class="link">{{ post.data.title }}</h3>
    <time class="small default">{{ post.data.date | date: "%d %B '%y" }}</time>
  </a>
{% endfor %}

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@grahambushell
Comment options

@pdehaan
Comment options

pdehaan Jun 10, 2021
Collaborator

Comment options

You must be logged in to vote
0 replies
Answer selected by grahambushell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants