Earlier and later links are inconsistent

I’m doing a blog where the file structure is:

content/yyyy/mm/dd-slugified-title.md

In each of the yyyy/mm folders, I have an _index.md file that looks like this:

+++
title = "March 2008"
sort_by = "date"
transparent = true
+++

The goal is that I could have next/previous links that allow you to navigate through the blog regardless of date.

What happens in practice is that some of the next/previous links appear as intended and others do not. It appears that the month (folder) boundaries are the point where it breaks, but even then it’s inconsistent.

I’ve often encountered the situation where page A (2008/03/05-blah.md) will have a next link to page B (2008/04/10-foo.md), but then page B will not have the corresponding previous link to page A.

This feels like a bug, but if I’m misusing Zola in some way, I’d be happy to receive feedback on how to accomplish what I’m trying to do.

I’m also a Rust-capable dev, so if there’s agreement that this is a bug, I can dig in a bit and try to submit a fix.

The YYYY/MM/DD should be in the filename, something like 2018-10-10-hello-world.md and in the same section. Right now what’s happening is that each month get its section so the sorting will not by actual time but by month. See my site for an example: https://github.com/Keats/vincentprouillet/tree/master/content/blog

Zola does not support YYYY/MM/DD formatting in the URL so if you want to keep that, it’s a bit more involved and painful to do so.

That structure looks fine for a site with a few dozen posts. I’m building something that is likely to have hundreds or maybe thousands of posts. More directory structure will definitely help me keep my sanity.

If I can figure out a way to make this work, would you welcome a PR?

I found a race condition in sort_sections_pages that semi-randomly counteracts what I think is the intent of the transparent = true flag as per documentation.

Looks like a fairly simple fix. PR coming.

1 Like