# Theme orders posts alphabetically, how do I change to sort by date?

**URL:** <https://discourse.gohugo.io/t/theme-orders-posts-alphabetically-how-do-i-change-to-sort-by-date/38923>\
**Category:** support\
**Created:** [June 3, 2022, 1:57pm UTC](https://discourse.gohugo.io/t/theme-orders-posts-alphabetically-how-do-i-change-to-sort-by-date/38923 "2022-06-03T13:57:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![buzzin](https://avatars.discourse-cdn.com/v4/letter/b/a183cd/32.png) [@buzzin](https://discourse.gohugo.io/u/buzzin)\
**Post date:** [June 3, 2022, 1:57pm UTC](https://discourse.gohugo.io/t/theme-orders-posts-alphabetically-how-do-i-change-to-sort-by-date/38923/1 "2022-06-03T13:57:34Z")

</div>

Hello everyone,

I am using the [gochowdown theme](https://github.com/seanlane/gochowdown), and while I’ve managed to customise it quite well on my own, I am struggling to change the sort order of the posts on the homepage. They are being listed alphabetically, but I want to sort them by date, so the newest post appears first.

I’ve tried poking around a bunch of files, as well as done a lot of web searching and reading the docs, but my knowledge is in HTML and CSS, and not areas which involve what {{- .Data.Singular | title -}} means, for example. Despite my best efforts to try and wrap my head around this, I’m not knowledgable enough to know what or where the section of code is that I need to change. It’s been hours at this point, so I thought I should ask for some assistance now.

Thank you for your time and any help you can give, and I apologise if this has been asked elsewhere, I did search extensively, but maybe I missed something obvious.

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [June 3, 2022, 2:21pm UTC](https://discourse.gohugo.io/t/theme-orders-posts-alphabetically-how-do-i-change-to-sort-by-date/38923/2 "2022-06-03T14:21:19Z")

</div>

[https://github.com/seanlane/gochowdown/blob/master/layouts/partials/home.html#L4](https://github.com/seanlane/gochowdown/blob/master/layouts/partials/home.html#L4)

Change:

```auto
{{ range sort (where .Site.RegularPages "Section" "recipes") "Title" }}

```

To:

```auto
{{ range (where .Site.RegularPages "Section" "recipes").ByDate.Reverse }}

```

See [https://gohugo.io/templates/lists#order-content](https://gohugo.io/templates/lists#order-content). Given that you are not specifying `weight` in each recipe’s front matter, you can also rely on Hugo’s [default sort order](https://gohugo.io/templates/lists#order-content):

```auto
{{ range where .Site.RegularPages "Section" "recipes" }}

```

---

<div class="post-metadata">

**Author:** ![buzzin](https://avatars.discourse-cdn.com/v4/letter/b/a183cd/32.png) [@buzzin](https://discourse.gohugo.io/u/buzzin)\
**Post date:** [June 3, 2022, 2:23pm UTC](https://discourse.gohugo.io/t/theme-orders-posts-alphabetically-how-do-i-change-to-sort-by-date/38923/3 "2022-06-03T14:23:57Z")

</div>

Worked perfectly! Thank you so much!

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [June 5, 2022, 2:24pm UTC](https://discourse.gohugo.io/t/theme-orders-posts-alphabetically-how-do-i-change-to-sort-by-date/38923/4 "2022-06-05T14:24:54Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
