Posts on any index page in Ghost will be displayed in reverse chronological order by default, but it's possible to display posts in chronological order using the data property in the routes.yaml file.

If you have created content collections using the dynamic routing configuration layer in Ghost, and would like to display your content chronologically, this can be implemented using one extra line of code.

Create content collections

If you haven't already created a content collection, follow this tutorial first. Once you have a functional content collection rendering a distinct section on your site with it's own URL structure, you will be able to transform it from reverse chronological to chronological using this tutorial.

Download the routes.yaml file

Ensure you are working with the most recent version of your routes.yaml file by downloading it from the settings in Ghost admin and opening it with any code editor.

Use the order property in collections

Using the example below, let's assume that the /blog/ collection should remain reverse chronological, and the /podcast/ collection should be chronological:

collections:
  /blog/:
    permalink: /blog/{slug}/
    filter: tag:blog+tag:-podcast
  /podcast/:
    permalink: /podcast/{slug}/
    filter: tag:podcast+tag:-blog

Use the order property with it's two parameters asc or desc to determine ascending or descending order. For example:

collections:
  /blog/:
    permalink: /blog/{slug}/
    filter: tag:blog+tag:-podcast
    order: desc
  /podcast/:
    permalink: /podcast/{slug}/
    filter: tag:podcast+tag:-blog
    order: asc

Implement your collections and templates

Once you have set the order for your posts to be rendered for your collections, upload the new version of your routes.yaml file back into the settings in Ghost admin. If you've made any changes to templates or CSS, ensure you also upload the latest version of your theme as a .zip.

When this is done, check your publication to ensure the index page of the collection you wanted to render in chronological order is working as expected.

Summary

In this tutorial you have successfully rendered chronological content in one or more collections on your site. It's possible to do this with any distinct sections of content on a Ghost publication as required.