How can I read in chronological order?

Alas, @sod, it doesn’t work. The footer renders empty (no links to next or previous page), see screenshots below.

:point_up_2: single.html in Design

:point_up_2: single page (blog post) on test blog (with two pages in total)

:point_up_2: html source of the above blog post

This new version depends on the category you said you post under: dagboek. You can see that accounted for in the first part of the template:

{{ $diaryPages := .Site.Taxonomies.categories.dagboek.Pages.Reverse }}

If your test blog differs from your production blog, that snippet won’t work. Does your test blog have the category set up and posts assigned to that category?

No, it didn’t have any categories. I added those, and now it does work. Now testing on “the big blog.”

It works. A minor issue is that the most recent post points to the very first post, but that’s easy to fix by changing the wording (earlier to previous, later to next).

Thanks a lot. You helped me tremendously. :kissing_heart:

2 Likes

And now’s the time I try to decide if I feel the energy to try to adapt this “reverse chronological by day” to Marfa…

FWIW, I did use jsonbecker’s code and got this working in a Marfa template.

https://bixfrankonis-test.micro.blog/

ETA: Hrm. I just discovered this breaks when paginating. I set my test blog to paginate at 5 posts, and it put the later of two posts from a given day on the first page and the earlier of the two on the second page.


Hey, @jsonbecker, I’ve a question about your “reverse days, chrono posts within days” code, which I played with adapting for Marfa thusly.

{{ define "main" }}  

{{ $posts := where site.RegularPages "Type" "post" }}
{{ $grouped := $posts.GroupByDate "2006-01-02" }}
{{ $paginated := (.Paginate ($grouped)) }}
<ul id="post-list">
{{ range $paginated.PageGroups }}
{{ $thedate := (time .Key) }}
<div class="day" style="text-align: center;"><aside class="dates" style="color: #000;">{{ $thedate.Format "Jan 2, 2006" }}</aside></div>
  {{ range .Pages.Reverse }}
    {{ if eq .Type "post" }}
{{ partial "post-item.html" . }}
    {{- end }}
  {{ end }}
{{ end }}
</ul>
{{ partial "pagination.html" . }}
{{ end }}

The default Marfa file is below. Does anything jump out at you that I need to suss out how to incorporate from the default file that I didn’t already? (I’m not making a request that you do the work for me, just wondering if you see something obvious that I should be looking at. I’m no coder but I’m generally good at understanding code’s logic if I have a pointer or two.) Thanks!

{{ define "main" }}

<ul id="post-list">

{{ if or .IsHome .Site.Params.paginate_categories }}
	{{ $paginator := .Paginate (where .Site.Pages.ByDate.Reverse "Type" "post") }}
	{{ $list := $paginator.Pages }}
	{{ range $list  }}
		{{ partial "post-item.html" . }}
	{{ end }}
{{ else }}
	{{ $list := where .Site.Pages.ByDate.Reverse "Type" "post" }}
	{{ range $list  }}
		{{ partial "post-item.html" . }}
	{{ end }}
{{ end }}

</ul>

{{ if .IsHome }}
	{{ if .Site.Params.paginate_home }}
		{{ partial "pagination" . }}
	{{ end }}
{{ else if .Site.Params.paginate_categories }}
	{{ partial "pagination" . }}
{{ end }}

{{ end }}

Nothing too specific. This code is cleaner than that earlier post (and is from my current theme which I have written as a plug-in but not released) https://github.com/jsonbecker/theme-dailylog/blob/main/layouts/index.html

I don’t really know what the logic about paginated by category or home pages etc is trying to accomplish since I’m not familiar with Marfa.

I was just tackling the Dave Winer-style blog organization. But now I can’t figure out the problem that erupts upon pagination, which I noticed on your site, too. It’s like it’s counting out the number of posts for the page first, then passing that to the Winery magic, stranding the wrong post on the next page.

I’m pretty sure that’s a Hugo bug and/or some default somewhere in the pagination functions that I haven’t tracked down. I’m quite confident what I wrote is as close as you will be able to find about Hugo anywhere on the internet-- it may be worth asking on the Hugo forums, someone may know what default value I’m hitting into to split them up. It’s also possible it’s a micro.blog oddity, though I doubt it-- there are some times defaults that get picked up set by Micro.blog if they’re not overwritten, but those have been reduced over time.

I wrote a post on the Hugo forums to see if anyone there has an idea.

I see there isn’t good news there. I admit that I find Hugo’s inability to do some pretty basic blog-related things somewhat exasperating.