Why is "lower": null, "higher": null,?


I have read the documentation pages carefully 3 times and built a sample site following the docs, that does almost everything I will want. And I think Zola is excellent, does what it needs to and no more. The developers deserve a big applause.

but this is the one thing I don’t get. for a blog page, when I do {{ __tera_context }}, I get

 "lower": null, "higher": null, 

I tried every parameter combination I could think of and could not find any place in the documentation that says these are not always defined. or conditions under which they might not be defined.

I know I am missing something blindingly obvious.

I am on the latest zola on a mac (from 5 days ago), installed from brew.

thanks for making this great ssg


OK, I solved it, sort of

Read the parent section variables in,

{% set assets = get_section(path="Assets/_index.md") %}

and that allows me to get the length, {{ assets.pages | length }}, access elements, {{ assets.pages[1].title }} and ultimately to put the next/last nav links on my posts, and have them roll over when at start/end.

But I assumed that is what lower/upper do automatically. Why I am puzzled why they are null. And this is super clumsy.

, all the best, and I am liking Zola more and more


and if anybody is looking for a worked out example.

If correct, might be be nice to put into the documentation.

{% set assets = get_section(path="Assets/_index.md") %}
{% set n = assets.pages |length %}
{% for i in range(end=n) %}
    <h3>{{i}} {{ assets.pages[i].title}}</h3>
    {% if assets.pages[i] ==     page %}
        <h3> where we are at {{ page.title }}</h3>
        {% set last=i-1 %}
        {% set next=i+1 %}
        {% if last<0 %}
            {% set last=n-1 %}
        {% if next> n-1 %}
            {% set next=0 %}
        <h3>last {{last}}  {{ assets.pages[last].title}} | this {{ assets.pages[i].title}} | next  {{next}} {{ assets.pages[next].title}} </h3>
    {% endif%}
{% endfor %}

It’s only filled if there is Section | Zola set in the section because otherwise there is no sorting and hence no ordering.

1 Like

Thanks @keats, goes to show that when one thinks one has tried everything, there is still another parameter to set, and now it works!

do you mind if I ask you if my solution above is the right one if I want to it roll over, i.e. lower for post[0] to be post [n-1] ?

best, j