kirby-staticbuilder icon indicating copy to clipboard operation
kirby-staticbuilder copied to clipboard

Issue with `$page->hasNextVisible()`

Open zvaehn opened this issue 5 years ago • 1 comments

Hi,

I am currently facing the following issue. The logic shown below works perfectly fine on the development site, but shows a very strange behavior in the static version.

What it should do: Generate a sibling link or if the current page is the last page in the sibling set, start from the first sibling.

What it actually does: Every page genereates a link which points to the very first page, this page points then correctly to the second one, but the second page points back to the first page.

// Get the next visible project
if($page->hasNextVisible()) {
  $nextUrl = $page->nextVisible()->url();
}
// Start from the beginning
else {
  if($siblings = $page->siblings(false)->visible()) {
    $nextUrl = $siblings->first()->url();
  }
}

Am i missing something or is this actually a bug? Thanks for your help!

zvaehn avatar Jun 12 '19 09:06 zvaehn

This workarround also worked for me: #39

zvaehn avatar Jun 12 '19 09:06 zvaehn