Maybe a better question is why the else
statements in this pagination snippet return website.com
instead of website.com/first-article
. Going off of this thread: Navigation / pagination loop
<?php
if($page->hasNextVisible() || $page->hasPrevVisible()): ?>
<nav class="pagination wrap cf">
<?php if($page->hasPrevVisible()): ?>
<a class="pagination-item nav prev" href="<?= $page->prevVisible()->url() ?>" rel="prev" title="<?= $page->prevVisible()->title()->html() ?>">›</a>
<?php else: ?>
<a class="pagination-item nav prev" href="<?= $page->last()->visible()->url() ?>" rel="prev">›</a>
<?php endif ?>
<?php if($page->hasNextVisible()): ?>
<a class="pagination-item nav next" href="<?= $page->nextVisible()->url() ?>" rel="next" title="<?= $page->nextVisible()->title()->html() ?>">‹</a>
<?php else: ?>
<a class="pagination-item nav next" href="<?= $page->first()->visible()->url() ?>" rel="next">‹</a>
<?php endif ?>
</nav>
<?php endif ?>