Giter Club home page Giter Club logo

Comments (2)

flaviocopes avatar flaviocopes commented on May 24, 2024

Reading the code, if there is no adjacent sibling, the collection is returned. So you should first call page.isLast(). Is this the cause of the different behavior?

from grav-learn.

PZ01 avatar PZ01 commented on May 24, 2024

Here's how I use the page :

<ul class="pagination-gold">
    {{ dump(page.isLast()) }} <!-- Returns FALSE -->
    {{ dump(page.adjacentSibling(-1)) }} <!-- Returns Collection -->
    {% if page.isLast() == false %}
    <li class="next">
        <a href="{{ page.adjacentSibling(-1).url }}"> NEXT Post <i class="fa fa-angle-double-right"></i></a>
    </li>
    {% endif %}
    {% if page.isFirst() == false %}
    <li class="previous">
        <a href="{{ page.adjacentSibling(1).url }}"> <i class="fa fa-angle-double-left"></i> PREVIOUS POST</a>
    </li>
    {% endif %}
</ul>

The same code is used for my other tag and I get the next sibling so the problem must be related to how I pass the collections. I believe I am already properly calling the isLast() method.

I do not know if this can help, but I attached my folder structure.
structure
I have all my pages in a 'News' folder, but for other categories I use separate folders. According to the docs, using @taxonomy will retrieve all the published pages in /page so it should be good. I will keep investigating.

from grav-learn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.