.PrevInSection and .NextInSection content pages sorting order

I have all my content in sections, and I only use weight: and title: in the front matter (I do not use any dates). Example:

content/
     my-section/
          a.md (weight: 10)
          b.md (weight: 20)
          c.md (weight: 30)

With the

{{range .Sections}}
  {{range .Pages}}
    {{.Title}}
  {{end}}
{{end}}

I correctly get the order:

a
b
c

However when I am in b.md, .NextInSection point to a.md and .PrevInSection points to c.md.

This seems a bit backwards to me and it’s contradicting how .Sections.Pages is taking weight into account.

.NextInSection
pointer to the following content within the same section (based on publishdate field in front matter

.PrevInSection
Pointer to the previous content within the same section (based on publishdate in front matter). For example, {{if .PrevInSection}}{{.PrevInSection.Permalink}}{{end}}.

The above is from the Docs and it’s very clearly stated that PublishDate is taken into account not Weight.

I’m closing this thread. There is no point in discussing the naming of variables that were decided years ago.

The above is from a PM.

No, I don’t mind reopening this topic again, since you request it.

I have seen first hand, that when .PublishDate is missing then .Date is taken into account for .PrevInSection and NextInSection.

If you feel that something is missing from the Docs Pull Requests are welcome.

EDIT
Also I renamed the topic since it’s really about the sorting order of content pages that are rendered with .PrevInSection and NextInSection and not the naming of these variables as it seemed in your first post @ahmet

You are correct. This is a bug. But that is separate from other part of your question related to weights.

An issue is already open for this bug:

1 Like

Apologies @ahmet I was not aware of this bug.