I’m trying to build my own blog and i’ve found myself lost with this issue.
I have 30 articles, and pagination is set to show only 8 articles per page.
First page shows my latest 8 articles without a problem, second page shows only 1 article.
Doesn’t matter how plenty articles I add, pagination generates only two pages, and the rest of articles are ‘lost’. Any ideea? here’s also my code, maybe i done something wrong thanks :D.
<ul>
<?php foreach ($list = $page->children()->paginate(8) as $item): ?>
<li><!-- item html --></li>
<?php endforeach ?>
</ul>
<?php $pagination = $list->pagination() ?>
<nav class="navpag">
<ul>
<?php if ($pagination->hasPrevPage()): ?>
<li>
<a href="<?= $pagination->prevPageURL() ?>">‹</a>
</li>
<?php else: ?>
<li>
<span>‹</span>
</li>
<?php endif ?>
<?php foreach ($pagination->range(10) as $r): ?>
<li>
<a<?= $pagination->page() === $r ? ' aria-current="page"' : '' ?> href="<?= $pagination->pageURL($r) ?>">
<?= $r ?>
</a>
</li>
<?php endforeach ?>
<?php if ($pagination->hasNextPage()): ?>
<li>
<a href="<?= $pagination->nextPageURL() ?>">›</a>
</li>
<?php else: ?>
<li>
<span>›</span>
</li>
<?php endif ?>
</ul>
</nav>
<main class="articolele" role="main">
<?php foreach($articles = $page->children()->listed()->flip()->paginate(8) as $article): ?>
<article class="card hvr-float">
<?php if($image = $article->image()): ?>
<img class="imaginecard" src="<?= $image->url() ?>" alt="" loading="lazy">
<?php endif ?>
<h2 class="titlucard"><a class="titlucarda" href="<?= $article->url() ?>"><?= $article->title()->html() ?></a></h2>
<div class="continutcardcontainer">
<p class="continutcard"><?= $article->text()->excerpt(150) ?></p>
</div>
<?= $article->intro()->kirbytext() ?>
<div class="vezireteta">
<a href="<?= $article->url() ?>">Vezi Rețeta</a>
<p class="dataarticol"><svg class="svgtime" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="https://retete.pe-zona.ro">
<path d="M9 7H11V12H16V14H9V7Z" fill="currentColor" />
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12ZM20 12C20 16.4183 16.4183 20 12 20C7.58172 20 4 16.4183 4 12C4 7.58172 7.58172 4 12 4C16.4183 4 20 7.58172 20 12Z"
fill="currentColor"/></svg><?= $article->Published()->html() ?></p>
</div>
</article>
<?php endforeach ?>
</main>