Can't get posts sorted by date in Hyde-Hyde theme

Hi,

I was trying to create a new blog using the Hyde-Hyde theme and couldn’t get the post links to appear on the homepage and ‘posts’ page in date-order (newest first). I tried several changes to different partials but wasn’t able to resolve the issue.

I posted a github issue on the Hyde-Hyde theme repo a week ago, as well as a minimal reproducible example on Stack Overflow two days ago (and just added a 100-point bounty) but haven’t gotten any responses so far.

Any help would be much appreciated!

That is the home page, which in that theme is rendered by layouts/index.html:

    {{ $paginator := .Paginate (where .Site.RegularPages "Type" "in" site.Params.mainSections) }}
    {{ range $paginator.Pages }}

That’s setting your paginator, and then range through it. You probably want:

    {{ range $paginator.Pages.ByDate.Reverse }}

Note it is using the default sort order for content, and the Sep. post is weighted while the other posts are not. That can affect the listings, as well.

Hey thanks a lot for the quick reply! Will try this out now…

Update: it works! Thanks a lot!

Also, the solution for the ‘posts’ page was to change
{{range .}}
to:
{{ range .ByDate.Reverse }}

in themes/hyde-hyde/layouts/partials/posts-list.html.

@maiki if you post the answer on the Stack Overflow link I’ll accept it and designate it for the bounty (in case you care about SO points). Otherwise I’ll post the answer there myself tomorrow just so there’s a record there of the answer as well. Thanks again.

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