Foreach loop "forgets" one child page

Alright guys, I really can’t figure out what is happening here. I’ve found a “workaround” so there is no urgency, but maybe this’ll make a nice little puzzle :slight_smile:

I have ten child pages. Their page titles start with either “2-level” or “4-level”. There’s five child pages of each:

  • 2-level-first-page
  • 2-level-second-page
  • et cetera
  • 4-level-sixth-page
  • 4-level-seventh-page
  • et cetera

I realize Kirby uses a number and dash to order visible child pages.

In my template, the foreach loop shows nine out of ten child pages. The one page it “forgets” is the fifth page, so that’s the last of the “2-level” pages.

All pages have a similar content structure. My foreach loop doesn’t limit to nine items.

As I said, I’ve found a workaround - I’ve added separate numbers to all pages to make them visible and manually order them. But I just can’t figure out why that specific page won’t show up in my loop…

What is your Kirby version?
Are you sorting the pages in your foreach loop?

I’m running 2.5.10 (latest version). I’m not sorting the pages in my loop.

I guess, that if you ignore the sorting number „2-“, „4-“ in the directory names or compare the title names, two names of different pages are the same.

That might indeed be the issue here. From a Kirby point of view 2-something and 4-something are identical.

But the weird thing is, when I stick to the prefixes (2-level-first-page, 2-level-second-page, 4-level-first-page, and so on), the foreach loop shows all pages but one. And the page that isn’t shown isn’t the first page in alphabetical order, it’s the fifth (so the last page of the “2-level” pages).

Strange, right?

Could you post a screenshot of your folder structure?