# Earlier and later links are inconsistent

**URL:** <https://zola.discourse.group/t/earlier-and-later-links-are-inconsistent/901>\
**Category:** Support\
**Created:** [May 12, 2021, 2:57am UTC](https://zola.discourse.group/t/earlier-and-later-links-are-inconsistent/901 "2021-05-12T02:57:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![probable-potato](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/probable-potato/32/594_2.png) [@probable-potato](https://zola.discourse.group/u/probable-potato)\
**Post date:** [May 12, 2021, 2:57am UTC](https://zola.discourse.group/t/earlier-and-later-links-are-inconsistent/901/1 "2021-05-12T02:57:29Z")

</div>

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:

```auto
+++
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.

---

<div class="post-metadata">

**Author:** ![keats](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@keats](https://zola.discourse.group/u/keats)\
**Post date:** [May 12, 2021, 12:24pm UTC](https://zola.discourse.group/t/earlier-and-later-links-are-inconsistent/901/2 "2021-05-12T12:24:01Z")

</div>

> [@probable-potato](#):
>
> content/yyyy/mm/dd-slugified-title.m

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](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.

---

<div class="post-metadata">

**Author:** ![probable-potato](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/probable-potato/32/594_2.png) [@probable-potato](https://zola.discourse.group/u/probable-potato)\
**Post date:** [May 12, 2021, 4:50pm UTC](https://zola.discourse.group/t/earlier-and-later-links-are-inconsistent/901/3 "2021-05-12T16:50:55Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![probable-potato](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/probable-potato/32/594_2.png) [@probable-potato](https://zola.discourse.group/u/probable-potato)\
**Post date:** [May 13, 2021, 3:56am UTC](https://zola.discourse.group/t/earlier-and-later-links-are-inconsistent/901/4 "2021-05-13T03:56:15Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![probable-potato](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/probable-potato/32/594_2.png) [@probable-potato](https://zola.discourse.group/u/probable-potato)\
**Post date:** [May 13, 2021, 4:12am UTC](https://zola.discourse.group/t/earlier-and-later-links-are-inconsistent/901/5 "2021-05-13T04:12:59Z")

</div>

> <https://github.com/getzola/zola/pull/1456>
>
> \## Code changes
> 
> There is a race condition in the generation of next/previous …page links when combined with sections that use \`transparent = true\`. I use next/previous generically to all manner of sorting (date, title, weight).
> 
> The next/previous links are generated per-section, but the sections themselves are iterated in an apparently arbitrary sequence. A parent section may be iterated before or after its child. For each page, the last section which \_might\_ contain it wins, which means the next/previous links \_may or may not\_ include page from sibling sections.
> 
> This change disables the generation of next/previous page references for sections with \`transparent = true\`, meaning that larger list of pages available to the (grand)parent section will be the only (sorted) list used to generate next/previous references.
> 
> I believe this is in keeping with the intent of the transparent flag, as quoted from documentation here:
> 
> \`\`\`
> \# If set to "true", the section will pass its pages on to the parent section. Defaults to \`false\`.
> \# Useful when the section shouldn't split up the parent section, like
> \# sections for each year under a posts section.
> transparent = false
> \`\`\`
> 
> \* \[x\] Are you doing the PR on the \`next\` branch?
> 
> If the change is a new feature or adding to/changing an existing one:
> 
> \* \[\] Have you created/updated the relevant documentation page(s)? \_n/a - no new API created\_
