Having difficulties with Jekyll / Liquid

jekyll, liquid

Solution

I had better luck using page.next/previous

    {% if page.previous %} 
        <a rel="prev" href="{{ page.previous.url }}">&larr; Older</a>
    {% endif %}
    {% if page.next %} 
        <a rel="next" href="{{ page.next.url }}">Newer &rarr;</a>
    {% endif %}

Problem

I'm tring to do a loop for Nav links below my posts. This is going into the _layout of posts.html I can't get the link to not show if the post is the last or the first. Any help would be awesome. ``` {% for post in site.posts %} {% if post.previous != forloop.last %} ← Last {% elsif post.next != forloop.first %} Next → {% endif %} {% endfor %} ```

Original source