# How to sort jekyll pagination by date

**URL:** <https://talk.jekyllrb.com/t/how-to-sort-jekyll-pagination-by-date/3358>\
**Category:** Help\
**Created:** [September 16, 2019, 1:10pm UTC](https://talk.jekyllrb.com/t/how-to-sort-jekyll-pagination-by-date/3358 "2019-09-16T13:10:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Goyllo](https://avatars.discourse-cdn.com/v4/letter/g/e9a140/32.png) [@Goyllo](https://talk.jekyllrb.com/u/Goyllo)\
**Post date:** [September 16, 2019, 1:10pm UTC](https://talk.jekyllrb.com/t/how-to-sort-jekyll-pagination-by-date/3358/1 "2019-09-16T13:10:21Z")

</div>

I don’t have any date frontmatter in my blog post.

The only date is available in my blog post name is `2019-09-16-my-first-blog-post.md`

I’m using these code in my index.html(homepage)

```
{% for post in paginator.posts %}

  <li class="post">
  	<h2><a href="{% if site.baseurl == "/" %}{{ post.url }}{% else %}{{ post.url | prepend: site.baseurl }}{% endif %}">{{ post.title }}</a></h2><br/>
  	<p>{{ post.content }}</p>
  </li>

{% endfor %}

```

This code doesn’t return latest post by date.

In past when I was not using pagination then I was using this for loop

> {% for post in site.posts limit:20 %}

And it returns latest 20 post in my homepage.

I’ve tried to add `| sort: 'date'` but nothing works on above code.

p.s. I’m using custom permalink in my all blog post, do you think that cause problem? Jekyll state that, but they did not specify it will break the order of post.
