can you explain actual behavior of next/prev.
Probably I do not understand the concept of collection or I’m doing something wrong.
Functions like nextSibling still not working for me.
Native collection @self.siblings excludes current page from the collection (according to docs). That is propably reason, why at least these methods are not working: page.isFirst(), page.isLast(), .page.prevSibling(), .page.nextSibling().
The workaround is to set another collection in the template and use that one instead of the native collections.
{% set groupofpages = page.collection({‘items’:{’@page’: ‘/portfolio/tables’}}) %}
That makes listing of pages in current level in folder structure a bit complicated. Hopefully someone has idea how to solve this?
Yep sorry I was misinformed on @self.siblings. As @lexyk says, that collection returns the siblings without the current page, so the collection does know know at which point it is in the current collection, as it does not contain the current page…
Hey guys, Thanks. But I’m sorry. This is not working for me again. I have no parent pages for these pages. All of them are root pages. I tried cacti approach, but without luck.
Otherwise:
What happen when I set root page (md file, content:items:) to @root and then I will need move this page from root somewhere deeper into the web structure. That mean I need care about this. And just rewrite @root to @self.childern or whatever?
This is working pretty fine for taxonomy (I did not test taxonomy so much).
But when core doesn’t know what is next page on same level, without this kind of dependency linking. Especially on flat file system. It is wierd for me.
I’m really sorry for telling this. But I did not expect I will spend couple of hours
on this basic task.
Just now I will try patch the core Page.php class and add @self.allsiblings which
will contain all pages on current level. Understand this is pretty dirty.
But is is the easiest solution of my problems. This kind of collection is missing to me.
Understand, that is not problem crete pull request. But first I will test patch at all. I need to be sure it is not not causing some unexpected problems.