Subscribe to PHP Freaks RSS

Grav CMS: previous is next

syndicated from planet-php.net on April 20, 2018

I'm using Grav CMS for a new project and am building my own theme for it.

When adding links to the previous and next blog posts, I noticed something strange: When I am on the first blog post (PageCollection::isFirst($page.path) == true), $collection.nextSibling() is empty.

Also, when I'm on the last page, $collection.prevSibling() is empty.

It turns out that those two methods do the opposite as I thought:

Post number prevSibling nextSibling
5 6 4

Other people were also confused, but Grav is used too much now that changing the behavior would break many many pages.